CentOS 7 Installing the Python 3.6,PIP3 error problem __python

Source: Internet
Author: User
Tags install openssl openssl sessions

After installing Python3.6.3 on CentOS 7, the following error was used in the PIP command times

Traceback (most recent call last): File "/usr/python3.6.3/lib/python3.6/site-packages/pip/basecommand.py", line 215, in Main status = Self.run (options, args) File "/usr/python3.6.3/lib/python3.6/site-packages/pip/commands/search.py", L INE, in Run pypi_hits = self.search (query, Options) File "/usr/python3.6.3/lib/python3.6/site-packages/pip/comman ds/search.py ", line, in search hits = Pypi.search ({' name ': Query, ' Summary ': query}, ' or ') File"/usr/python3.6.3 /lib/python3.6/xmlrpc/client.py ", line 1112, in __call__ return Self.__send (Self.__name, args) File"/usr/python3.6. 3/lib/python3.6/xmlrpc/client.py ", line 1452, in __request verbose=self.__verbose File"/usr/python3.6.3/lib/python3 .6/site-packages/pip/download.py ", line 775, in Request Headers=headers, stream=true) File"/usr/python3.6.3/lib/pyt hon3.6/site-packages/pip/_vendor/requests/sessions.py ", line 522, in Post return Self.request (' post ', url, Data=data, Json=json, **kwargs) FiLe "/usr/python3.6.3/lib/python3.6/site-packages/pip/download.py", line 386, in Request return super (pipsession, self) . Request (method, URL, *args, **kwargs) File "/usr/python3.6.3/lib/python3.6/site-packages/pip/_vendor/requests/ sessions.py ", line 475, in Request RESP = self.send (Prep, **send_kwargs) File"/usr/python3.6.3/lib/python3.6/site-p ackages/pip/_vendor/requests/sessions.py ", line 596, in Send R = adapter.send (Request, **kwargs) File"/usr/python3. 6.3/lib/python3.6/site-packages/pip/_vendor/cachecontrol/adapter.py ", line, in Send resp = Super (cachecontroladapt Er, self). Send (Request, **kw) File "/usr/python3.6.3/lib/python3.6/site-packages/pip/_vendor/requests/adapters.py" , line 497, into send raise Sslerror (E, request=request) Pip._vendor.requests.exceptions.sslerror:can ' t connect to HTTP S URL because the SSL module is not available.


Because the reason for not properly configured SSL, after several experiments, summed up the correct installation steps.

Installation steps:

1. Download Python 3.6.3

https://www.python.org/downloads/source/

2. Decompression

. xz files need to be decompressed using the XZ tool, first install XZ

sudo yum install xz

xz d python-3.6.3.tar.xz


tar xvf python-3.6.3.tar

3. Download/install OpenSSL and openssl-devel. No wget can be installed via yum install wget

wget https://www.openssl.org/source/openssl-1.1.0g.tar.gz
At the CentOS 7 minimum installation, the OpenSSL is installed by default, but I did not find the installed Lib path, so I uninstalled it and installed myself because the path needed to install Python3.6. To uninstall the OpenSSL command:

sudo yum erase OpenSSL

Install OpenSSL:

Tar zxvf openssl-1.1.0g.tar.gz

cd openssl-1.1.0g

./config--prefix=/usr/local/openssl

Make

Make install

Where the--prefix path is the directory that will be installed, remember to use the following.

Download Openssl-devel and install

sudo yum install Openssl-devel

4. Add Lib Read path

sudo vi/etc/ld.so.conf

Add a row at the end

/usr/local/openssl/lib
This path is the path where the OpenSSL was just installed. Then execute the following command to make it effective

sudo ldconfig

5. Modify the Modules/setup.dist file in the Python installation package to open the part of the SSL annotation, and modify it as follows:

# Socket Module helper for SSL support; You must comment out
of the other # socket line above, and possibly edit the SSL variable:
ssl=/usr/local/openssl
  
   _ssl _ssl.c \
        -duse_ssl-i$ (SSL)/include-i$ (SSL)/include/openssl \
        -l$ (SSL)/lib-lssl-lcrypto
  

Where the path behind ssl= is the path you actually install OpenSSL


6. Configure Installation

./configure--prefix=/usr/python3.6.3
Make
Make install

If you cannot find a libssl.so.1.1 error during the installation process, check the configuration for steps 3rd and 4th.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.