How to switch between python2 and python3 interpreters in the fourth section of the first part

   The computer has both python2 and python3 installed, so how can I freely use the interpreter I want to use instead of uninstalling one of them, because the installation and environment of python3.6.5 have been introduced in the second section of the first article. The configuration of variables, the method and steps of python2 installation are also similar. If you don’t understand, you can check it directly. Here we mainly introduce how to freely use the python interpreter you want to use from two directions. Suppose you want to use python3 now, then How to make the system default python is python3:

 First, python2 and python3 are installed at the same time. Enter the environment variable to view the path content, as follows:

  

If the location of python2 is before python3, the current default python interpreter is python2:

 

1. The first method: Set the default python version you want through the configuration of the path environment variable, and let the default python interpreter be python3:

    At this point, put the installation path of python3 and the contents of the Script directory in python2, as shown below:

      

   At this time, the default interpreter is python3. Type: python in the cmd command window. At this time, the python3 related information is similar to the following screenshot:

        

     In this way, the current default interpreter is python3 (note that in order to avoid other meaningless problems, the path in the user variable and the path in the system variable should be as consistent as possible for the position of the path)

 2. The second method: directly modify the interpreter name, still take python3 as an example, then directly rename the python2 interpreter (not python.exe, can be modified to python2.exe)

                          

                          

       At this time, use python in the cmd command window, and the default is python3 at this time   

       If you want to use the python2 interpreter, you can also directly enter python2 in the cmd window, and the python2 interpreter will be opened.

       

   Of course, you can also rename the python3 interpreter python.exe to python3.exe, and the python2 interpreter python.exe to python2.exe

In this case, you can directly want to use that interpreter. The steps are the same as the 2 method. In this way, if you type python2 in the cmd command window, the python2 interpreter will be opened. If the typed command is python3, the opened interpreter will be python3

 The next section will be the installation of pycharm and the configuration of the interpreter, including the introduction of the simple function of the font background of the interface

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324663555&siteId=291194637