Under Ubun18.04 version, switching between different versions of python

I have been doing deep learning recently, and when configuring the environment, I need to install different versions of python in the Linux system. After the installation is complete, enter python in the terminal and version 2.7.17 is always displayed. There is no switch to the installed 3.7.0 version.

Finally found the solution in .bashrc. 

After installing different versions of python in the Linux system, you need to find the corresponding location in .bashrc and modify the current version of python. The location of the file .bashrc is in the home folder. Use the Ctrl+H keys to display all files and find it. As shown in the picture:

 After opening it, find and comment out alias python=python2 with #. Then, remove the #alias python=python3 # below and save it. The final result is as follows:

 At this time, open a new terminal and enter python to get the changed python version (remember to open a new terminal, because the old terminal still has the previous python version). As shown in the picture:

 

Guess you like

Origin blog.csdn.net/m0_62648611/article/details/125756326