Home >Backend Development >Python Tutorial >How to install or upgrade Python 2.7 under Linux
The following editor will bring you an article on how to install or upgrade Python 2.7 under Linux. The editor thinks it is quite good, so I will share it with you now and give it as a reference for everyone. Let’s follow the editor and take a look
1. Prepare the compilation environment 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 the version you want to download and use the wget command to download the corresponding 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 搜索结果(一般就在Python文件根目录下)
2) Configure
./configure
5. Compile
make make install
(If there are no other special requirements, the installation ends here. Enter pythonx.x to enter your The python development environment 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
The above is the detailed content of How to install or upgrade Python 2.7 under Linux. For more information, please follow other related articles on the PHP Chinese website!