Python pip install mysql connector Python 2.0.1失败

2024-04-26 01:17:20 发布

您现在位置:Python中文网/ 问答频道 /正文

在开发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))

这是虫子吗?


Tags: installdjangofrom命令txt应用程序connectorvenv
3条回答

在PIP上打包的方式有一个突出的缺陷。 以下是详细信息:http://bugs.mysql.com/bug.php?id=76063

您可以使用以下命令安装同一链接中提到的mysql连接器:

wget https://cdn.mysql.com/Downloads/Connector-Python/mysql-connector-python-2.0.3.zip
unzip mysql-connector-python-2.0.3.zip
cd mysql-connector-python-2.0.3
python setup.py install

由于包维护程序出错,pip无法安装mysql python connector。Here is the relevant issue filed against that package's bug tracker.尽管从技术上讲,它应该可以用

pip install --allow-external mysql-connector-python --allow-unverified mysql-connector-python mysql-connector-python

如果包维护程序未能correctly register the external URLs to PyPI,则此操作不起作用。

注意,PyMySQL似乎是一个完全的替代品,它是一个纯Python MySQL驱动程序,实现了pythondbapi2.0规范。另外,PyMySQL看起来是主动维护的,上传到PyPI(而不是托管在外部url上),并且是在更慷慨的MIT许可下(而不是GPLv2许可)。

如果不想手动安装,请尝试此操作:

sudo pip3 install --extra-index-url https://pypi.python.org/pypi/mysql-connector-python/2.0.4 mysql-connector-python

为我在Debian Jessie工作。

相关问题 更多 >