我尝试将我的网站安装在centos 7的Web服务器上,其中包含django 2.0.6和python 3.6。
我安装了: mysql-connector = 2.1.6
, mysql-connector-python = 8.0.11
, MySQL-python = 1.2.5
, mysqlclient = 1.3.12
, PyMySQL = 0.8.1
当我运行这个命令时:
python3.6 manage.py migrate
我有一个错误:
File "MYPYTHONPATH/python3.6/site-packages/django/db/backends/mysql/base.py", line 36, in <module>
raise ImproperlyConfigured("mysqlclient 1.3.3 or newer is required; you have %s" % Database.__version__)
django.core.exceptions.ImproperlyConfigured: mysqlclient 1.3.3 or newer is required; you have 1.2.5
但是在base.py文件中:
try:
import MySQLdb as Database
except ImportError as err:
raise ImproperlyConfigured(
'Error loading MySQLdb module.\n'
'Did you install mysqlclient?'
) from err
from MySQLdb.constants import CLIENT, FIELD_TYPE # isort:skip
from MySQLdb.converters import conversions # isort:skip
# Some of these import MySQLdb, so import them after checking if it's installed.
from .client import DatabaseClient # isort:skip
from .creation import DatabaseCreation # isort:skip
from .features import DatabaseFeatures # isort:skip
from .introspection import DatabaseIntrospection # isort:skip
from .operations import DatabaseOperations # isort:skip
from .schema import DatabaseSchemaEditor # isort:skip
from .validation import DatabaseValidation # isort:skip
version = Database.version_info
if version < (1, 3, 3):
raise ImproperlyConfigured("mysqlclient 1.3.3 or newer is required; you have %s" % Database.__version__)
我不明白我能做些什么来解决这种问题!我希望有人能帮我()
1条答案
按热度按时间b5buobof1#
好吧,我用这条线索的答案解决了。
没有名为mysqldb的模块
然后将这两行添加到project/project/init.py
适用于win和Python3.3+