用于Django 1.9和Python 3.5的Python连接器?

时间:2022-02-10 19:17:49

I'm working with the latest version of Python and Django as of the date of this question and I cannot find a connector that will work for MySQL which supports Python 3.5. Does anybody have a solution to this problem? I'm running on a Windows platform.

截至本问题发布之日,我正在使用最新版本的Python和Django,我找不到适用于支持Python 3.5的MySQL的连接器。有没有人有解决这个问题的方法?我在Windows平台上运行。

When I try to download the mysqlclient from here here, I'm running Python 3.5.1 32 on Windows 8.1. I download the wheel, I attempt to install the wheel file using pip, I get the error that

当我尝试从这里下载mysqlclient时,我在Windows 8.1上运行Python 3.5.1 32。我下载了滚轮,我尝试使用pip安装滚轮文件,我得到错误

mysqlclient-1.3.7-cp27-none-win32.whl is not a supported wheel on this platform.

mysqlclient-1.3.7-cp27-none-win32.whl不是此平台上支持的*。

Apparently this wheel is supposed to work on Python 3.5.

显然这个*应该适用于Python 3.5。

To make sure I'm not having a problem elsewhere, since I'm new to this whl format, I downloaded another package (BeautifulSoup4) and confirmed the installation of that wheel file is working, so it appears to be a problem with my operating system and the wheel file for mysqlclient.

为了确保我在其他地方没有问题,因为我是这个whl格式的新手,我下载了另一个软件包(BeautifulSoup4)并确认该轮文件的安装正在运行,所以它似乎是我操作的问题系统和mysqlclient的wheel文件。

1 个解决方案

#1


14  

As cgohlke said, mysqlclient can not currently be compiled on Python 3.5 for Windows because the MySQL Connector/C is not yet compatible with the Visual Studio 2015 compiler required by Python 3.5.

正如cgohlke所说,mysqlclient目前无法在Python 3.5 for Windows上编译,因为MySQL Connector / C还不兼容Python 3.5所需的Visual Studio 2015编译器。

Follow the related GitHub issue : mysqlclient-python - Not working with python 3.5 to be aware when this bug will be fixed.

遵循相关的GitHub问题:mysqlclient-python - 不使用python 3.5来了解何时修复此错误。

When this issue will be fixed, mysqlclient should work.

当这个问题得到解决时,mysqlclient应该可行。

Temporary solution with unofficial Windows binaries : mysqlclient-1.3.7

使用非官方Windows二进制文件的临时解决方案:mysqlclient-1.3.7

From Django 1.9 documentation :

来自Django 1.9文档:

Django supports MySQL 5.5 and higher.

Django支持MySQL 5.5及更高版本。

Django requires mysqlclient 1.3.3 or later. Note that Python 3.2 is not supported. Except for the Python 3.3+ support, mysqlclient should mostly behave the same as MySQLDB.

Django需要mysqlclient 1.3.3或更高版本。请注意,不支持Python 3.2。除了Python 3.3+支持外,mysqlclient的行为应该与MySQLDB相同。

From mysqlclient 1.3.7 package index :

从mysqlclient 1.3.7包索引:

mysqlclient is a fork of MySQL-python. It adds Python 3.3~ support and merges some pull requests.

mysqlclient是MySQL-python的一个分支。它增加了Python 3.3~支持并合并了一些pull请求。

MySQL-4.1 through 5.5 and Python-2.7, 3.3-3.5 are currently supported. PyPy is supported.

目前支持MySQL-4.1到5.5和Python-2.7,3.3-3.5。支持PyPy。

#1


14  

As cgohlke said, mysqlclient can not currently be compiled on Python 3.5 for Windows because the MySQL Connector/C is not yet compatible with the Visual Studio 2015 compiler required by Python 3.5.

正如cgohlke所说,mysqlclient目前无法在Python 3.5 for Windows上编译,因为MySQL Connector / C还不兼容Python 3.5所需的Visual Studio 2015编译器。

Follow the related GitHub issue : mysqlclient-python - Not working with python 3.5 to be aware when this bug will be fixed.

遵循相关的GitHub问题:mysqlclient-python - 不使用python 3.5来了解何时修复此错误。

When this issue will be fixed, mysqlclient should work.

当这个问题得到解决时,mysqlclient应该可行。

Temporary solution with unofficial Windows binaries : mysqlclient-1.3.7

使用非官方Windows二进制文件的临时解决方案:mysqlclient-1.3.7

From Django 1.9 documentation :

来自Django 1.9文档:

Django supports MySQL 5.5 and higher.

Django支持MySQL 5.5及更高版本。

Django requires mysqlclient 1.3.3 or later. Note that Python 3.2 is not supported. Except for the Python 3.3+ support, mysqlclient should mostly behave the same as MySQLDB.

Django需要mysqlclient 1.3.3或更高版本。请注意,不支持Python 3.2。除了Python 3.3+支持外,mysqlclient的行为应该与MySQLDB相同。

From mysqlclient 1.3.7 package index :

从mysqlclient 1.3.7包索引:

mysqlclient is a fork of MySQL-python. It adds Python 3.3~ support and merges some pull requests.

mysqlclient是MySQL-python的一个分支。它增加了Python 3.3~支持并合并了一些pull请求。

MySQL-4.1 through 5.5 and Python-2.7, 3.3-3.5 are currently supported. PyPy is supported.

目前支持MySQL-4.1到5.5和Python-2.7,3.3-3.5。支持PyPy。