I cannot install mysql-connector-python using pip
我正在尝试安装
1 2 3 | 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)) |
直到几天前,它运作良好。 我调查了一下,在bitbucket.org中发现了以下问题。 具体而言,以下评论日期为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.
如何安装
我需要建立自己的存储库吗?
有很多解决方案,例如托管私有存储库,但最快的是更改
即改变:
1 | mysql-connector-python==1.0.12 |
至
1 | https://cdn.mysql.com/Downloads/Connector-Python/mysql-connector-python-2.1.15.tar.gz |
对于像我这样的所有懒人,他们必须谷歌如何处理需求文件
这样做......
1 | echo https://cdn.mysql.com/Downloads/Connector-Python/mysql-connector-python-2.1.3.tar.gz >> requirements.txt |
那么这个。
1 | sudo -H pip install -r ./requirements.txt |
核实。
1 | pip list | grep mysql |
它应该输出:
1 | mysql-connector-python (2.1.3) |
快乐的日子感谢@Amnon
为我工作使用
更多信息请访问https://github.com/travis-ci/travis-ci/issues/5369
以上链接对我不起作用,或者在尝试安装到AWS Beanstalk时不起作用。但以下链接确实有效:
1 | https://cdn.mysql.com/Downloads/Connector-Python/mysql-connector-python-2.0.4.zip#md5=3df394d89300db95163f17c843ef49df |
红帽/ CentOS
1 2 | sudo yum install python-devel mysql-devel sudo pip3 install mysql-connector |
对于其他操作系统,请参阅mysqlclient
如果您使用的是
1 2 3 | setup( dependency_links=['http://cdn.mysql.com/Downloads/Connector-Python/mysql-connector-python-2.1.4.zip'] ) |
更多内容在Packages Not On PyPI文档中指定。