Skip to main content
 首页 » 编程设计

pip之我无法使用 pip 安装 mysql-connector-python


我尝试安装 mysql-connector-python==1.0.12 作为项目自动安装的一部分,但我从 pip install 收到以下错误:

Collecting mysql-connector-python==1.0.12 (from -r /tmp/requirements.txt (line 20)) 
Could not find a version that satisfies the requirement mysql-connector-python==1.0.12 (from -r /tmp/requirements.txt (line 20)) (from versions: ) 
No matching distribution found for mysql-connector-python==1.0.12 (from -r /tmp/requirements.txt (line 20)) 

直到几天前,它还运行良好。我调查了一下,发现了以下issue in 。具体来说,以下评论日期为 2015 年 12 月 28 日:

That should be blank, per PEP 470 using PyPI to link to a package not hosted by PyPI for automated installers to download (the /simple/ index) was deprecated and scheduled for removal. Maintainers of the affected packages were emailed 3 months ago. The removal happened earlier today (a bug caused some oackages like Twisted which were hosted on PyPI to also have their links removed but that has been remedied). The maintainers of MySQL-connector-python should either upload to PyPI or direct their users to use either -f or --extra-index-url with a repository they maintain.

如何让mysql-connector-python==1.0.12安装顺利进行? 我需要设置自己的存储库吗?


有很多解决方案,例如托管私有(private)存储库,但最快的方法是更改​​ requirements.txt 文件以从 mysql 的 cdn 下载。