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

yipeiwu_com5年前Python基础

编译安装全是坑……

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

总结

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

相关文章

Python 使用 prettytable 库打印表格美化输出功能

Python 使用 prettytable 库打印表格美化输出功能

pip install prettytable 每次添加一行 from prettytable import PrettyTable # 默认表头:Field 1、Field 2....

python3.6+selenium实现操作Frame中的页面元素

python3.6+selenium实现操作Frame中的页面元素

有时网页中会嵌套一个或者多个Frame,此时我们直接去找嵌套在Frame里面的元素会抛出异常,所以在操作的时候我们需要将页面焦点切换到Frame里面,下面我们就以一个实例演示一下! 首先...

Python通过select实现异步IO的方法

本文实例讲述了Python通过select实现异步IO的方法。分享给大家供大家参考。具体如下: 在Python中使用select与poll比起在C中使用简单得多。select函数的参数是...

Python 如何优雅的将数字转化为时间格式的方法

将数字转化成时间格式 from dateutil.parser import parse a=20170825 b=str(a) c=parse(b) print(c) 20...

python开发之基于thread线程搜索本地文件的方法

python开发之基于thread线程搜索本地文件的方法

本文实例讲述了python开发之基于thread线程搜索本地文件的方法。分享给大家供大家参考,具体如下: 先来看看运行效果图: 利用多个线程处理搜索的问题,我们可以发现他很快.......