Methods of updating Python version and modifying Python default version by Linux

Time:2021-10-14

Update the python version under Linux and modify the default version. Friends in need can refer to it.

In many cases, the python version of the server is very low, and you need to change the default Python version yourself

1. Download the python installation package from the official website (this version can be any version 3.3, 2.7, 2.6, etc.)

wget http://python.org/ftp/python/2.7/Python-2.7.tar.bz2 

 2. Unzip and install


 tar -jxvf Python-2.7.tar.bz2 
cd Python-3.3.0 
./configure 
make all 
make install 
make clean 

make distclean   Python is installed in / usr / local / bin / python2.7 by default. You can execute the following command to view the version

/Usr / local / bin / python2.7 – V, and the system’s default Python is placed at / usr / bin / python2.6 (this 2.6 is the system’s default version)
Therefore, a soft connection needs to be established to point to the default Python directory of the current system, so that the system can use the new Python version

MV / usr / bin / Python / usr / bin / python2.6 / / operate on the default version of Python
ln -s /usr/local/bin/python2.7 /usr/bin/python    // Note that the first path is the newly installed Python version path, and the second path is the system default path
  When the modification is completed, enter Python – V or Python to see that the version number has been modified to the newly installed version

PS:

1. If the new Python version is modified, the previously installed Python plug-ins are not in the new version Python directory, so they need to be reinstalled

2. Some people have updated the python version and can’t use yum. They need to modify its configuration file for yum

vi /usr/bin/yum   Put the file header in #/ Change usr / bin / Python to #/ Usr / bin / python2.6 (note that this is the python number of the previous old version, because the old version can support Yum only at this time)

The above contents are the methods to update the python version of Linux and modify the default version shared by Xiaobian. I hope you like it.

Recommended Today

The selector returned by ngrx store createselector performs one-step debugging of fetching logic

Test source code: import { Component } from ‘@angular/core’; import { createSelector } from ‘@ngrx/store’; export interface State { counter1: number; counter2: number; } export const selectCounter1 = (state: State) => state.counter1; export const selectCounter2 = (state: State) => state.counter2; export const selectTotal = createSelector( selectCounter1, selectCounter2, (counter1, counter2) => counter1 + counter2 ); // […]