How to install or upgrade Python 2.7 under Linux

  • 2020-06-19 12:28:08
  • OfStack

1. Prepare to build gcc

2. Go to the official website to download the source code of the corresponding version of python to be installed

Download address: https: / / www python. org/downloads source /

You can choose which version you want to download and use the wget directive to download the source code

3. Unzip the downloaded code package


tar -zxvf Python-x.x.x.tgz
cd Python-x.x.x

4. Configuration

1) Find the configure file


find . -name configure
cd  Search results ( 1 Just like in Python File root directory) 

2) Configuration


./configure

5. Compile


make
make install

(If there are no other special requirements, the installation is over. Enter ES37en.x to access the python development environment you just installed.)

6. Replace the previous default version of python (create a new soft connection)


cd /usr/bin/
rm -rf python
ln -s /usr/local/Python-x.x.x/bin/python ./python

Related articles: