Install the libffi-devel dependency, then recompile and install python3.7.1.
yum -y install libffi-devel
Execute the command to install again.
2. After installing Python, execute the version commands separately
$python -V
$Python3 -V
To use the new version, you need to link to the new version of Python (see the Python path, under /usr/bin. You can see the Python link is Python 2.7.
$ls -al /usr/bin | grep python
Rename the original Python soft link:
$mv /usr/bin/python /usr/bin/python.bak
Link Python to Python 3:
$ln -s /usr/local/bin/python3 /usr/bin/python
3. YUM cannot be used after changing the version
The terminal input yum list and report an error
$yum list
File "/usr/bin/yum", line 30
except KeyboardInterrupt, e:
SyntaxError: invalid syntax
Modify /usr/bin/yum and /usr/libexec/urlgrabber-ext-down to #! The/usr/bin/python to #! /usr/bin/python2.7 = /usr/bin/python2.7 = /usr/bin/python2.7
$vi /usr/bin/yum
$vi /usr/libexec/urlgrabber-ext-down
4. If you do not have root access, you will need to update the PIP after you update Python. Installation steps are as follows:
Download address: https://pypi.org/project/pip/#files
Install command: pip3 install – install – option = “– prefix =/GPFS/home/chengqy/soft/path” PIP – 20.1.1 – py2. Py3 – none – any. WHL
Read More:
- Error handling method of “no module named ‘stringio’” in Python 3
- Composer update encountered “Script php artisan optimize handling the post-update-cmd event returne when upgrading laravel
- Linux Installation Error Handling
- [Jackson exception] com.fasterxml.jackson . databind.JsonMappingException Exception handling method
- Linux environment setup – Update https://apt.repos.intel.com report errors
- Export and import method of MySQL under Linux
- Essay (19) Ubuntu 16 + python2.7 update PIP report error no module named typing
- Method of modifying file and folder permission by Chmod command in Linux
- Python 3.7 pyGame download method
- Python’s direct method for solving linear equations (5) — square root method for solving linear equations
- Linux’s method of clearing DNS cache and refreshing DNS in shell terminal (Ubuntu, Debian)
- About node error NPM update check failed try running with sudo or get access to the local update
- The method of getting shell command output in Python
- Detailed explanation of Python__ new__() method
- Python switch / case statement implementation method
- 8024401c cannot be updated, update failed, update error
- Method of ignoring case in Python string comparison
- Typeerror: write() argument must be STR, not bytes and the method of writing binary file in Python 3
- Typeerror: write() argument must be STR, not bytes and the method of writing binary file in Python 3
- Multi file decompression method GZ00 gz01 zip00 zip01 in windors Linux