Python3 Linux Installation (Redhat):
- Download python-3.6.4.tgz:
https://www.python.org/downloads/release/python-364/
- Yum Install dependent packages (varies per machine)
Yum install openssl-devel bzip2-devel expat-devel gdbm-devel readline-devel sqlite-devel//installation of possible dependent libraries
TAR-ZXVF python-3.6.4.tgz
CD python-3.6.4/
./configure--prefix=/usr/local///install to/usr/local directory
Make
Make Altinstall//cannot be installed here, because install does not differentiate version, there will be multiple version confusion problem
Execution file for python3.6 program:/usr/local/bin/python3.6
python3.6 application directory:/usr/local/lib/python3.6
PIP3 execution File:/usr/local/bin/pip3.6
Pyvenv3 execution File:/usr/local/bin/pyvenv-3.6
Cd/usr/bin
MV Python Python.backup
Ln-s/usr/local/bin/python3.6/usr/bin/python
Ln-s/usr/local/bin/python3.6/usr/bin/python3
Rm-rf/usr/bin/python2
Ln-s/usr/bin/python2.6/usr/bin/python2
Installing a high version of Python will result in Yum not being used, yum is dependent on Python, and Yum will not be able to use it directly after installing Python3, with the following error, which requires a direct designation of the interpreter that modifies the Python script in Yum.
Modify the header files for the/usr/bin/yum and/usr/bin/usr/bin/urlgrabber two files, and change the first line #!/usr/bin/python to #!/usr/bin/python2
Run yum install gcc again, everything is OK, haha.
- To install a third-party package:
Https://pypi.python.org/pypi?%3Aaction=search&term=pyperclip&submit=search
Download via pip3.6:
pip3.6 Install PyPDF2
To the third-party installation path check:
Create firstpythonscript.py
# !/usr/bin/python3 Import = open ('sbt.in.action.2015.11.pdf'rb' = Pypdf2.pdffilereader (pdffileobj)print= pdfreader.getpage (+) Print(Pageobj.extracttext ())
Give Execute permission:
chmod +x firstpythonscript.py
Perform:
Done!
Python3 Linux Installation (Redhat)