CentOS 6.8 安裝 Python3

來源:互聯網
上載者:User

標籤: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安裝包了。

 

up vote4down vote

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-optimizationsmake 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

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.