相关疑难解决方法(0)

如何确定我的python shell是否在OS X上以32位或64位模式执行?

我需要一种方法来告诉shell在shell中的模式.

我试过看平台模块,但它似乎只是告诉你"关于位体系结构和用于可执行文件的链接格式":二进制编译为64位虽然(我在OS X 10.6上运行)所以它似乎总是报告64位,即使我使用这里描述的方法强制32位模式).

python macos

386
推荐指数
15
解决办法
30万
查看次数

在mac上安装MySQL-python

我正在使用OSX 10.8和PyCharm来处理Python开发项目.我已经使用网站上的说明为mac安装了MySQL-python

http://blog.infoentropy.com/MySQL-python_EnvironmentError_mysql_config_not_found

但是,运行该项目会给我这个错误:

django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb module: dlopen(/Users/ashishagarwal/.python-eggs/MySQL_python-1.2.3-py2.7-macosx-10.6-intel.egg-tmp/_mysql.so, 2): Symbol not found: _mysql_affected_rows
  Referenced from: /Users/ashishagarwal/.python-eggs/MySQL_python-1.2.3-py2.7-macosx-10.6-intel.egg-tmp/_mysql.so
  Expected in: flat namespace
 in /Users/ashishagarwal/.python-eggs/MySQL_python-1.2.3-py2.7-macosx-10.6-intel.egg-tmp/_mysql.so
Run Code Online (Sandbox Code Playgroud)

错误中提到的文件存在于该位置 - /Users/ashishagarwal/.python-eggs/MySQL_python-1.2.3-py2.7-macosx-10.6-intel.egg-tmp/_mysql.so

整个错误消息是 -

/usr/local/bin/python2.7-32 /Users/ashishagarwal/Optimus/MashPotato/backend/mashpotato/manage.py testserver --addrport 8000
Running on development server
Traceback (most recent call last):
  File "/Users/ashishagarwal/Optimus/MashPotato/backend/mashpotato/manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/core/management/__init__.py", line 453, in execute_from_command_line
    utility.execute()
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/core/management/__init__.py", line 392, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/core/management/__init__.py", line 272, in fetch_command
    klass = load_command_class(app_name, subcommand)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/core/management/__init__.py", line 77, in load_command_class …
Run Code Online (Sandbox Code Playgroud)

python macos mysql-python python-2.7

32
推荐指数
1
解决办法
5万
查看次数

Mac OS 10.6.2 Snow Leopard上的Django + MySQL

这个问题已经有了一些很好的答案,然而,它们现在已经过时了.

我已经能够安装模块,但"python manage.py runserver"失败了

 iMac:myproject drhoden$ python manage.py runserver
 Validating models...
 Unhandled exception in thread started by <function inner_run at 0x10496f0>
 Traceback (most recent call last):
   File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/django/core/management/commands/runserver.py", line 48, in inner_run
     self.validate(display_num_errors=True)
   File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/django/core/management/base.py", line 249, in validate
     num_errors = get_validation_errors(s, app)
   File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/django/core/management/validation.py", line 22, in get_validation_errors
     from django.db import models, connection
   File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/django/db/__init__.py", line 41, in <module>
     backend = load_backend(settings.DATABASE_ENGINE)
   File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/django/db/__init__.py", line 17, in load_backend
     return import_module('.base', 'django.db.backends.%s' % backend_name)
   File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/django/utils/importlib.py", line 35, in import_module …
Run Code Online (Sandbox Code Playgroud)

python mysql django osx-snow-leopard

9
推荐指数
1
解决办法
1万
查看次数

EPFImporter创建表但不导入任何内容

我正在使用Apple的EPFImporter工具http://www.apple.com/itunes/affiliates/resources/documentation/epfimporter.html

这是一个Python脚本,它将采用空格分隔的EPF文件列表并将它们导入我的数据库.

这就是我所拥有的:

Braden-Keiths-MacBook-Pro:~ bradenkeith$ ./EPFImporter.py /Users/bradenkeith/Downloads/popularity20120314 
Run Code Online (Sandbox Code Playgroud)

以下是CLI返回的内容:

2012-03-14 22:12:28,748 [INFO]: Beginning import for the following directories:
    /Users/bradenkeith/Downloads/popularity20120314 
2012-03-14 22:12:28,748 [INFO]: Importing files in /Users/bradenkeith/Downloads/popularity20120314 
2012-03-14 22:12:28,749 [INFO]: Starting import of /Users/bradenkeith/Downloads/popularity20120314... 
2012-03-14 22:12:28,749 [INFO]: Beginning full ingest of epf_application_popularity_per_genre (2000491 records) 
2012-03-14 22:14:28,774 [INFO]: ...at record 1797000... 
2012-03-14 22:16:02,152 [INFO]: Full ingest of epf_application_popularity_per_genre took 0:03:33.402408 
2012-03-14 22:16:02,196 [INFO]: Import of popularity20120314 completed at: 12-03-14 22:16:02 
2012-03-14 22:16:02,196 [INFO]: Total import time for popularity20120314: 0:03:33.44 
2012-03-14 22:16:02,196 [INFO]: …
Run Code Online (Sandbox Code Playgroud)

python mysql

7
推荐指数
2
解决办法
1333
查看次数