在开发Django应用程序时,我使用以下命令安装MySQL(python3):
(Venv)$ pip3 install mysql-connector-python --allow-external mysql-connector-python
安装成功,pip3 freeze > requirements.txt
显示已安装mysql-connector-python==2.0.1
。
但是,在生产环境中,pip3 install -r requirements.txt
产生了以下错误消息。
Downloading/unpacking mysql-connector-python==2.0.1 (from -r requirements.txt (line 6))
Could not find any downloads that satisfy the requirement mysql-connector-python==2.0.1 (from -r requirements.txt (line 6))
这是一个错误吗?
答案 0 :(得分:4)
在PIP上打包的方式存在一个突出的问题。 以下是详细信息:http://bugs.mysql.com/bug.php?id=76063
您可以使用以下命令安装mysql-connector,如同在同一链接上提到的那样:
UIColor
答案 1 :(得分:1)
pip install --allow-external mysql-connector-python --allow-unverified mysql-connector-python mysql-connector-python
如果软件包维护者未能correctly register the external URLs to PyPI,则无效。
请注意,PyMySQL似乎是一个完全替代品,作为实现Python DB API 2.0规范的纯Python MySQL驱动程序。此外,PyMySQL似乎被积极维护,上传到PyPI(而不是托管在外部URL上),并且是更慷慨的MIT许可(与GPLv2许可相对)。
答案 2 :(得分:0)
如果您不想手动安装,请尝试此操作:
sudo pip3 install --extra-index-url https://pypi.python.org/pypi/mysql-connector-python/2.0.4 mysql-connector-python
Debian Jessie为我工作。