Linux install Python2.7

 

The following example is based on python 2.7.9, other versions are the same. ##

1. Download python #

wget https://www.python.org/ftp/python/2.7.9/Python-2.7.9.tgz

 

2. Unzip, compile and install (execute the following 5 commands in sequence) #

tar -zxvf Python-2.7.9.tgz

cd Python-2.7.9

./configure --prefix=/usr/local/python-2.7.9

make

make install

 

3. The system comes with a python version, we need to add a soft chain for the newly installed version #

ln -s /usr/local/python-2.7.9/bin/python /usr/bin/python2.7.9

 

4. To use this version, just enter "python2.7.9 + space + py script" #

python2.7.9 ~/helloworld.py

 

【Optional】#

If you want to use python to run the script instead of python 2.7.9, run the following command to complete the modification:

ln -s /usr/local/python-2.7.9/bin/python /usr/bin/python

 

The following example is based on python 2.7.9, other versions are the same. ##

1. Download python #

wget https://www.python.org/ftp/python/2.7.9/Python-2.7.9.tgz

 

2. Unzip, compile and install (execute the following 5 commands in sequence) #

tar -zxvf Python-2.7.9.tgz

cd Python-2.7.9

./configure --prefix=/usr/local/python-2.7.9

make

make install

 

3. The system comes with a python version, we need to add a soft chain for the newly installed version #

ln -s /usr/local/python-2.7.9/bin/python /usr/bin/python2.7.9

 

4. To use this version, just enter "python2.7.9 + space + py script" #

python2.7.9 ~/helloworld.py

 

【Optional】#

If you want to use python to run the script instead of python 2.7.9, run the following command to complete the modification:

ln -s /usr/local/python-2.7.9/bin/python /usr/bin/python

 

The following example is based on python 2.7.9, other versions are the same. ##

1. Download python #

wget https://www.python.org/ftp/python/2.7.9/Python-2.7.9.tgz

 

2. Unzip, compile and install (execute the following 5 commands in sequence) #

tar -zxvf Python-2.7.9.tgz

cd Python-2.7.9

./configure --prefix=/usr/local/python-2.7.9

make

make install

 

3. The system comes with a python version, we need to add a soft chain for the newly installed version #

ln -s /usr/local/python-2.7.9/bin/python /usr/bin/python2.7.9

 

4. To use this version, just enter "python2.7.9 + space + py script" #

python2.7.9 ~/helloworld.py

 

【Optional】#

If you want to use python to run the script instead of python 2.7.9, run the following command to complete the modification:

ln -s /usr/local/python-2.7.9/bin/python /usr/bin/python

 

Guess you like

Origin www.cnblogs.com/liuys635/p/12749593.html