Installation required on recent projects python Environmental Science , This blog is mainly about recording installation and introducing installation Python3.6.x The process of , It includes the following process :
(1) install python Depend on the environment
yum -y install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel
yum install gcc
Be careful : If installed python3.7.x Version of python, Need to install yum install libffi-devel -y
(2) Download the specified version of 3.6.x Of python
Download the offline package or online package in advance , for example wget https://www.python.org/ftp/python/3.6.8/Python-3.6.8.tgz
Be careful : If installed tensorflow,torch Equal module , Don't suggest python3.6.1 edition
(3) Unzip downloaded python
for example :tar -zxvf Python-3.6.8.tgz
(4) Create installation python The installation directory
for example , Installed in the /usr/local/python3 Under the table of contents , Create installation directory mkdir -p /usr/local/python3
(5) Compilation and installation python
Get into python Unzipped directory , for example :
cd Python-3.6.8
Input ./configure --prefix=/usr/local/python3
Compile input make
install make install
(6) Check python Interpreter
Input :/usr/local/python3/bin/python3.6
Output python Version of
(7) Create a soft connection
ln -s /usr/local/python3/bin/python3 /usr/bin/python3
ln -s /usr/local/python3/bin/pip3 /usr/bin/pip3
(8) Add environment PATH
vim /etc/profile
Enter the following :
# vim ~/.bash_profile
# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
# User specific environment and startup programs
PATH=$PATH:$HOME/bin:/usr/local/python3/bin
export PATH
preservation :wq
And then let the previous modification take effect :source ~/.bash_profile
(9) Check Python3 And pip3 Is it working properly :
python3 -V
pip3 -V
Be careful :arm64 Architecture installation python And linux install python The steps are the same
(7)(8)(9) The steps shall be determined according to the actual situation