centos6.5安装python3.7.1之后无法使用pip怎么办

这篇文章给大家分享的是有关centos6.5安装python3.7.1之后无法使用pip怎么办的内容。小编觉得挺实用的,因此分享给大家做个参考,一起跟随小编过来看看吧。

编译安装全是坑……

第一遍装完无法使用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文件删除掉。

感谢各位的阅读!关于“centos6.5安装python3.7.1之后无法使用pip怎么办”这篇文章就分享到这里了,希望以上内容可以对大家有一定的帮助,让大家可以学到更多知识,如果觉得文章不错,可以把它分享出去让更多的人看到吧!