pip无法在线安装mysql_关于pypi:我无法使用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))

直到几天前,它运作良好。 我调查了一下,在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.

如何安装mysql-connector-python==1.0.12顺利运行?

我需要建立自己的存储库吗?

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

即改变:

mysql-connector-python==1.0.12

https://cdn.mysql.com/Downloads/Connector-Python/mysql-connector-python-2.1.15.tar.gz

@Ammon你可以用https下载链接更新你的答案吗?cdn.mysql.com/Downloads/Connector-Python/… 由于安全原因,https是更好的选择

@AlexanderChekunkov,我更新了链接。

cdn.mysql.com/Downloads/Connector-Python/… - 版本2.1.3现在可用编辑以选择最新版本

我发现我需要pip install --egg http://dev.mysql.com/get/Downloads/Connector-Python/mysql-connector-python-2.1.4.zip才能使最新版本正常工作。

@emorris,我在答案中更新了链接。

对于像我这样的所有懒人,他们必须谷歌如何处理需求文件

这样做......

echo https://cdn.mysql.com/Downloads/Connector-Python/mysql-connector-python-2.1.3.tar.gz >> requirements.txt

那么这个。

sudo -H pip install -r ./requirements.txt

核实。

pip list | grep mysql

它应该输出:

mysql-connector-python (2.1.3)

快乐的日子感谢@Amnon

如果有,请更新cdn链接。 否则以下答案似乎更好:pip install mysql-connector-python-rf

为我工作使用

pip install mysql-connector-python-rf。

更多信息请访问https://github.com/travis-ci/travis-ci/issues/5369

以上链接对我不起作用,或者在尝试安装到AWS Beanstalk时不起作用。但以下链接确实有效:

https://cdn.mysql.com/Downloads/Connector-Python/mysql-connector-python-2.0.4.zip#md5=3df394d89300db95163f17c843ef49df

确实。 这是目前正在运行的链接。

红帽/ CentOS

sudo yum install python-devel mysql-devel

sudo pip3 install mysql-connector

对于其他操作系统,请参阅mysqlclient

如果您使用的是setup.py脚本,请保持install_requies中列出的依赖关系,但将属性depedency_links添加到带有列表的安装功能中,并将URL放在那里的包中。如:

setup(

dependency_links=['http://cdn.mysql.com/Downloads/Connector-Python/mysql-connector-python-2.1.4.zip']

)

更多内容在Packages Not On PyPI文档中指定。

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值