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

yipeiwu_com6年前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设计】的支持。如果你想了解更多相关内容请查看下面相关链接

相关文章

django重新生成数据库中的某张表方法

今天有碰到这种情况,数据库中有张表没办法通过migration来更改, migrate时报 django.db.utils.OperationalError: (1050, “Table...

Python定时任务APScheduler的实例实例详解

APScheduler 支持三种调度任务:固定时间间隔,固定时间点(日期),Linux 下的 Crontab 命令。同时,它还支持异步执行、后台执行调度任务。 一、基本架构 触发器...

python解析中国天气网的天气数据

使用方法:terminal中输入复制代码 代码如下:python weather.py http://www.weather.com.cn/weather/101010100.shtml...

python线程的几种创建方式详解

Python3 线程中常用的两个模块为: _thread threading(推荐使用) 使用Thread类创建 import threading from time...

Django1.7+python 2.78+pycharm配置mysql数据库

配置好virtualenv 和virtualenvwrapper后,使用pycharm创建新项目。之后要面临的问题就来了,之前一直使用的是sqlite作为开发数据库进行学习,按照之前看教...