码迷,mamicode.com
首页 > 编程语言 > 详细

CentOS 6.8 安装 Python3

时间:2018-01-11 22:18:01      阅读:245      评论:0      收藏:0      [点我收藏+]

标签:line   收获   variable   支持   ssi   support   bsp   socket   setup文件   

由于没有GCC无法编译安装Python3.6, 所以先安装GCC(yum install gcc)

下载地址:https://www.python.org/ftp/python/

 


1 tar zxvf Python-3.5.2.tgz

2 cd Python-3.5.2

3 ./configure --prefix=/usr/local/python35

4 make && make install

然后安装pip3,然后用pip3安装包的时候遇到:

pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available. 

解决办法:

# rpm -aq|grep openssl

1). yum install openssl-devel -y

     yum install openssl

      yum libssl-dev

2). 

#修改Setup文件
vi /usr/software/Python-2.7.5/Modules/Setup
#修改结果如下:
# Socket module helper for socket(2)
_socket socketmodule.c timemodule.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

3). 重新编译安装Python3

 ./configure --enable-optimizations

    make altinstall

4). 可以正常用pip3安装包了。

 

I ran into the same error when building Python 3.6.1 from source under CentOS 7. For CentOS7, I had to first:

sudo yum install openssl-dev

Then:

./configure --enable-optimizations
make altinstall

Now pip3.6 works :-)

 

 

refer: https://stackoverflow.com/questions/41489439/pip3-installs-inside-virtual-environment-with-python3-6-failing-due-to-ssl-modul

 

如果您认为这篇文章还不错或者有所收获,您可以通过右边的“打赏”功能 打赏我一杯咖啡【物质支持】,也可以点击下方的【好文要顶】按钮【精神支持】,因为这两种支持都是使我继续写作、分享的最大动力!

CentOS 6.8 安装 Python3

标签:line   收获   variable   支持   ssi   support   bsp   socket   setup文件   

原文地址:https://www.cnblogs.com/kex1n/p/8270261.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!