How to use the source code to install Python 3.8.1

The easiest way, of course yum install python3, but Oracle Linux 3.6.8 is installed by default, and I want to install some updated version.

Python3.8.1 installation process is as follows:

  1. From the official website download the source code package
  2. Decompression
  3. Enter the directoryPython-3.8.1
  4. According to the instructions README.rst:
    ./configure
    the make
    the make Test
    the sudo the make the install

The last two steps of a longer time period.
When I installed, the final step in error:

python 3.8.1 make install ModuleNotFoundError: No module named 'zlib'

After you install the zlib development package by:

sudo yum install zlib-devel

After you install the executable program for python3.8, python3 symbolic link point to this file:

$ python3 --version
Python 3.8.1

Upgrade pip:

$ pip3 install --user --upgrade pip
Collecting pip
  Using cached https://files.pythonhosted.org/packages/54/0c/d01aa759fdc501a58f431eb594a17495f15b88da142ce14b5845662c13f3/pip-20.0.2-py2.py3-none-any.whl
Installing collected packages: pip
Successfully installed pip-20.0.2

pip3 install a given module:

$ pip3 install --user pyinputplus
WARNING: pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.

Solution See here :

yum install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel
make
make install 

pip3 install a module error again:

WARNING: pip is being invoked by an old script wrapper. This will fail in a future version of pip.
Please see https://github.com/pypa/pip/issues/5599 for advice on fixing the underlying issue.
To avoid this problem you can invoke Python with '-m pip' instead of running pip directly.
WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='pypi.org', port=443): Read timed out. (read timeout=15)")': /simple/pyinputplus/
Collecting pyinputplus
  Using cached PyInputPlus-0.2.8.tar.gz (20 kB)
    ERROR: Command errored out with exit status 1:
     command: /usr/local/bin/python3.8 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-hofx1t7q/pyinputplus/setup.py'"'"'; __file__='"'"'/tmp/pip-install-hofx1t7q/pyinputplus/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-install-hofx1t7q/pyinputplus/pip-egg-info
         cwd: /tmp/pip-install-hofx1t7q/pyinputplus/
    Complete output (11 lines):
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/usr/local/lib/python3.8/site-packages/setuptools/__init__.py", line 20, in <module>
        from setuptools.dist import Distribution, Feature
      File "/usr/local/lib/python3.8/site-packages/setuptools/dist.py", line 35, in <module>
        from setuptools import windows_support
      File "/usr/local/lib/python3.8/site-packages/setuptools/windows_support.py", line 2, in <module>
        import ctypes
      File "/usr/local/lib/python3.8/ctypes/__init__.py", line 7, in <module>
        from _ctypes import Union, Structure, Array
    ModuleNotFoundError: No module named '_ctypes'
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

See the solution here , after re-install Python install the following package:

$ sudo yum install libffi-devel 
Published 377 original articles · won praise 43 · views 550 000 +

Guess you like

Origin blog.csdn.net/stevensxiao/article/details/104107512