CentOS 7 installs Python 3.6, pip3 error problem

After installing Python 3.6.3 on CentOS 7, the following errors occurred when using the pip command ...

After installing Python 3.6.3 on CentOS 7, the following errors occurred when using the pip command

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", line 45, in run pypi_hits = self.search(query, options) File "/usr/Python3.6.3/lib/python3.6/site-packages/pip/commands/search.py", line 62, 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/python3.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-packages/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 47, in send resp = super(CacheControlAdapter, self).send(request, **kw) File "/usr/Python3.6.3/lib/python3.6/site-packages/pip/_vendor/requests/adapters.py", line 497, in send raise SSLError(e, request=request) pip._vendor.requests.exceptions.SSLError: Can't connect to HTTPS URL because the SSL module is not available.


Because ssl is not configured correctly, after many experiments, summarize the correct installation steps.

Installation steps:

1. Download Python 3.6.3

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

2. Decompression

The.xz file needs to be decompressed with the xz tool, install xz first

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 minimum installation of CentOS 7, OpenSSL is installed by default, but I did not find the lib path to install it, so I uninstalled it and installed it myself, since the path is required to install Python 3.6.Command to uninstall openssl:

sudo yum erase openssl

Install openssl:

tar zxvf openssl-1.1.0g.tar.gz
cd openssl-1.1.0g
./config --prefix=/usr/local/openssl
makemake install

The path behind --prefix is the directory you will install, remember to use it below.

Download openssl-devel and install it

sudo yum install openssl-devel

4. Add lib read path

sudo vi /etc/ld.so.conf

Add a line at the end

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

sudo ldconfig

5. Modify Modules/Setup.dist File, open the commented out part of ssl, and modify it as follows:

# Socket module helper for SSL support; you must comment out 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 SSL = the path behind is where you actually install openssl


6. Configure Installation

./configure --prefix=/usr/Python3.6.3
make
make install

If the report cannot be found during installationLibssl.soError in.1.1, check the configuration of steps 3 and 4.

13 July 2020, 12:30 | Views: 3123

Add new comment

For adding a comment, please log in
or create account

0 comments