当前位置: 移动技术网 > IT编程>脚本编程>Python > centos6.5安装python3.7.1之后无法使用pip的解决方案

centos6.5安装python3.7.1之后无法使用pip的解决方案

2019年03月16日  | 移动技术网IT编程  | 我要评论

灌溉网,赵东民,宠爱甜心豹王爱奴

编译安装全是坑……

第一遍装完无法使用pip,报错找不到ssl模块。各种报错:

pip is configured with locations that require tls/ssl, however the ssl module in python is not available.
。。。
configure: error: invalid --with-openssl value
。。。

结果各种捣鼓。

1、注意cetos6.5自带的openssl版本是1.0.1,需要升级到1.0.2,升级完之后用openssl version检查一下;

2、提前安装好各种依赖包。yum install openssl-devel bzip2-devel expat-devel gdbm-devel readline-devel sqlite-devel gcc gcc-c++  libffi-devel

3、./configure --prefix=/usr/local/python 之后,需要进到modules里,修改setup如下(一般升级完openssl,openssl默认就在/usr/local/ssl文件夹了):

# socket module helper for socket(2)
_socket socketmodule.c
# socket module helper for ssl support; you must comment out the other
# socket line above, and possibly edit the ssl variable:
ssl=/usr/local/ssl
_ssl _ssl.c \
    -duse_ssl -i$(ssl)/include -i$(ssl)/include/openssl \
    -l$(ssl)/lib -lssl -lcrypto

把这5行的注释去掉。再进行make && make install,应该就能成功了。如果以前编译失败,记得把原来的makefile文件删除掉。

总结

以上就是这篇文章的全部内容了,希望本文的内容对大家的学习或者工作具有一定的参考学习价值,谢谢大家对移动技术网的支持。如果你想了解更多相关内容请查看下面相关链接

如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复

相关文章:

验证码:
移动技术网