pip安装py_zipkin时提示的SSL问题对应

yipeiwu_com5年前Python基础

python的应用实践zipkin,需要py_zipkin,使用pip进行安装py_zipkin的时候出现问题, 根据stackoverflow的信息设定了pypi.org 和 files.pythonhosted.org解决了问题。

问题现象

[root@kong ~]# pip install py_zipkin
Collecting py_zipkin
 Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError(1, u'[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:579)'),)': /packages/ef/87/e8fc3f124d491e635023a71f256769691037fc1451e5f5fb73846d6322d8/py_zipkin-0.11.0-py2.py3-none-any.whl
...省略
 Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError(1, u'[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:579)'),)': /packages/ef/87/e8fc3f124d491e635023a71f256769691037fc1451e5f5fb73846d6322d8/py_zipkin-0.11.0-py2.py3-none-any.whl
Could not install packages due to an EnvironmentError: HTTPSConnectionPool(host='files.pythonhosted.org', port=443): Max retries exceeded with url: /packages/ef/87/e8fc3f124d491e635023a71f256769691037fc1451e5f5fb73846d6322d8/py_zipkin-0.11.0-py2.py3-none-any.whl (Caused by SSLError(SSLError(1, u'[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:579)'),))
[root@kong ~]#

安装命令

pip install –trusted-host pypi.org –trusted-host files.pythonhosted.org py-zipkin

出现问题,需要安装python-devel,在ubuntu等上名为python-dev

[root@kong ~]# pip install --trusted-host pypi.org --trusted-host files.pythonhosted.org py-zipkin
Collecting py-zipkin
 Downloading https://files.pythonhosted.org/packages/ef/87/e8fc3f124d491e635023a71f256769691037fc1451e5f5fb73846d6322d8/py_zipkin-0.11.0-py2.py3-none-any.whl
Collecting thriftpy (from py-zipkin)
...省略
 gcc -pthread -fno-strict-aliasing -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -I/usr/include/python2.7 -c thriftpy/transport/cybase.c -o build/temp.linux-x86_64-2.7/thriftpy/transport/cybase.o
 thriftpy/transport/cybase.c:13:20: fatal error: Python.h: No such file or directory
  #include "Python.h"

安装日志

再次执行,安装成功

[root@kong ~]# pip install --trusted-host pypi.org --trusted-host files.pythonhosted.org py-zipkin
Collecting py-zipkin
 Downloading https://files.pythonhosted.org/packages/ef/87/e8fc3f124d491e635023a71f256769691037fc1451e5f5fb73846d6322d8/py_zipkin-0.11.0-py2.py3-none-any.whl
Requirement already satisfied: six in /usr/lib/python2.7/site-packages (from py-zipkin) (1.11.0)
Collecting thriftpy (from py-zipkin)
 Downloading https://files.pythonhosted.org/packages/f4/19/cca118cf7d2087310dbc8bd70dc7df0c1320f2652873a93d06d7ba356d4a/thriftpy-0.3.9.tar.gz (208kB)
  100% |################################| 215kB 2.0MB/s 
Requirement already satisfied: ply<4.0,>=3.4 in /usr/lib/python2.7/site-packages (from thriftpy->py-zipkin) (3.11)
Building wheels for collected packages: thriftpy
 Running setup.py bdist_wheel for thriftpy ... done
 Stored in directory: /root/.cache/pip/wheels/64/ff/0b/00a7ab5df78f8360908e34744eb78c2c537a327a295da5c260
Successfully built thriftpy
Installing collected packages: thriftpy, py-zipkin
Successfully installed py-zipkin-0.11.0 thriftpy-0.3.9
[root@kong ~]#

参考文档

https://stackoverflow.com/questions/25981703/pip-install-fails-with-connection-error-ssl-certificate-verify-failed-certi

总结

以上就是这篇文章的全部内容了,希望本文的内容对大家的学习或者工作具有一定的参考学习价值,谢谢大家对【听图阁-专注于Python设计】的支持。如果你想了解更多相关内容请查看下面相关链接

相关文章

Python cookbook(数据结构与算法)字典相关计算问题示例

本文实例讲述了Python cookbook(数据结构与算法)字典相关计算问题。分享给大家供大家参考,具体如下: 问题:在字典上对数据执行各式各样的计算(比如求最小值、最大值、排序)。...

Python基于贪心算法解决背包问题示例

本文实例讲述了Python基于贪心算法解决背包问题。分享给大家供大家参考,具体如下: 贪心算法(又称贪婪算法)是指,在对问题求解时,总是做出在当前看来是最好的选择。也就是说,不从整体最优...

Python对Excel按列值筛选并拆分表格到多个文件的代码

场景:集团中心下发本省数据时,并未按地市、业务拆分,现需要按地市、业务拆分并分发到地市。 本文利用Python的pandas包实现了以上场景。 注:本示例代码只实现按单列拆分,如果需要多...

python实现dict版图遍历示例

复制代码 代码如下:#_*_coding:utf_8_import sysimport os class Graph():    def __init__(...

Python实现购物评论文本情感分析操作【基于中文文本挖掘库snownlp】

Python实现购物评论文本情感分析操作【基于中文文本挖掘库snownlp】

本文实例讲述了Python实现购物评论文本情感分析操作。分享给大家供大家参考,具体如下: 昨晚上发现了snownlp这个库,很开心。先说说我开心的原因。我本科毕业设计做的是文本挖掘,用R...