我对Django和StackOverflow都是新手,所以我提前向你道歉。我不太确定如何格式化终端文本...
当我运行"python manage.py makemigrations myappname“时:
Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/Library/Python/2.7/site-packages/django/core/management/__init__.py", line 353, in execute_from_command_line
utility.execute()
File "/Library/Python/2.7/site-packages/django/core/management/__init__.py", line 327, in execute
django.setup()
File "/Library/Python/2.7/site-packages/django/__init__.py", line 18, in setup
apps.populate(settings.INSTALLED_APPS)
File "/Library/Python/2.7/site-packages/django/apps/registry.py", line 108, in populate
app_config.import_models(all_models)
File "/Library/Python/2.7/site-packages/django/apps/config.py", line 202, in import_models
self.models_module = import_module(models_module_name)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/importlib/__init__.py", line 37, in import_module
__import__(name)
File "/Users/weiqian/Documents/WCP/feature_01/sitedir/appuser/models.py", line 6, in <module>
class Tasks(models.Model):
File "/Library/Python/2.7/site-packages/django/db/models/base.py", line 108, in __new__
new_class.add_to_class('_meta', Options(meta, app_label))
File "/Library/Python/2.7/site-packages/django/db/models/base.py", line 299, in add_to_class
value.contribute_to_class(cls, name)
File "/Library/Python/2.7/site-packages/django/db/models/options.py", line 263, in contribute_to_class
self.db_table = truncate_name(self.db_table, connection.ops.max_name_length())
File "/Library/Python/2.7/site-packages/django/db/__init__.py", line 36, in __getattr__
return getattr(connections[DEFAULT_DB_ALIAS], item)
File "/Library/Python/2.7/site-packages/django/db/utils.py", line 212, in __getitem__
backend = load_backend(db['ENGINE'])
File "/Library/Python/2.7/site-packages/django/db/utils.py", line 116, in load_backend
return import_module('%s.base' % backend_name)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/importlib/__init__.py", line 37, in import_module
__import__(name)
File "/Library/Python/2.7/site-packages/django/db/backends/mysql/base.py", line 28, in <module>
raise ImproperlyConfigured("Error loading MySQLdb module: %s" % e)
django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb module: No module named MySQLdb我读了其他类似的问题,所以我尝试了"pip install MySQL-python“和许多其他版本,我得到了这个错误:
Command "python setup.py egg_info" failed with error code 1 in
/private/var/folders/vr/sgvcx9_n1hq4gtcknn7ln7d00000gn/T/pip-build-ON_V7M/mysql-python/从那里,我尝试更新setuptools,并得到以下错误:
OSError: [Errno 13] Permission denied:
'/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/__init__.py'我被卡住了..。有什么想法?非常感谢!
发布于 2016-03-14 05:03:15
最后一个错误意味着您没有足够的权限继续执行任务,您需要使用sudo运行该命令。
缺少的包是MySQL-python。您可以使用setuptools或pip安装它:
sudo easy_install MySQL-python sudo pip install MySQL-python
我建议您安装pip并使用它来管理项目的依赖项:sudo easy_install pip。安装pip后,您可以简单地sudo pip install packagename。
https://stackoverflow.com/questions/35975686
复制相似问题