几个月来,我一直想使用 MySQL,它对我的 django python 网站来说非常棒,但一直遇到同样的错误。我已经安装并重新安装了官方 Oracle MySQL 连接器 ( https://dev.mysql.com/doc/connector-python/en/connector-python-django-backend.html ) 以及来自 fork ( http://www.lfd.uci.edu/~gohlke/pythonlibs/#mysqlclient ) 的 MySQLClient 等各种软件包,这给了我一个错误。
Wheel not supported
当我使用 MySQL 连接器的文档页面上指定的后端代码时,我在服务器窗口中收到相同的错误。
ImportError: No module named 'mysql'
在我的settings.py
中,这是尝试导入时出错的行
imort os
import mysql.connector #this is where it errors out
我看过的页面: - stackoverflow.com/questions/37848035/mysql-connector-python-as-django-engine - stackoverflow.com/questions/26573984/django-how-to-install-mysql-connector-python-with-pip3 - docs.djangoproject.com/en/1.10/ref/databases/ 还有很多。请帮忙。
最佳答案
您是否尝试过使用破折号“-”安装“mysql-connector”?我认为它仍然是通过“import mysql.connector”导入的,但安装方式不同。 这似乎对我的项目有用。
关于python - MySQL 连接器不工作 | Django 1.10 | window | Python 3.5,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41906405/