Home>Article>Backend Development> How to check python installation path
The computer system used by each user may be different, and there will also be different versions of python installed. The way to view the python installation path will be different depending on the version.
The following is introduced using two different environments, Linux and Windows.
Linux
For the linux platform It is said that many running system software are based on python. If python makes an error, the entire system may be at risk of major problems. Let's take CentOS 7 as an example. In CentOS7, the basic version of python is 2.7, as shown in the figure below.
After the python command can be executed correctly, we first find the location of the python command. The command to find python is:
whereis python
The result is as shown below. You can see that the path is /usr/bin/python
Related recommendations: "python video tutorial"
Then we use this command to find out which installation package it is. The command is:
rpm -qf /usr/bin/python
The result is as shown in the figure below, you can see Go, the installation package is python-2.7.5
Then we can find the installation path of all its files according to the python installation package, and query all the files of the installation package The path command is:
rpm -ql python-2.7.5
As shown in the figure below, you can see that all python command paths are displayed.
But the above results do not show the location of all python library files, and you still need to find them. In Linux, the package name of the library file is generally the program name - libs. If we want to search for python here, the corresponding package name is python-libs. We use the rpm -qa command to query the following, and we can see that this package does exist. As shown in the figure below:
After finding this package, execute the same query command
rpm -ql python-libs
The corresponding results will all come out, as shown in the second picture below:
If you have a lot of third-party library files installed If so, the query results will be very long. Press the space bar to turn the page and scroll all the way to the bottom to see the location of the python-libs help file, as shown in the picture below. At this point, the installation paths of all python files on Linux have been found
Windows
windows platform If python has been installed If so, open the command line window, enter the python command and press Enter to enter the python command line interface. As shown in the picture below:
What we can be sure of at this time is that the installation path of python must have been added to the windows environment variables, because only when added to environment variables before it can be executed from the command line. Therefore, we only need to open the environment variable path to find the installation path of python. First, right-click on the computer icon on the desktop and select Properties.
Then click Advanced System Settings on the right side of the Computer Properties page, as shown in the picture below:
Advanced You can see the environment variables under the system settings. After clicking it, find the PATH variable in the user variables, and then click the edit button in the lower right corner.
In the opened PATH variable, we can clearly see the installation path of python, as shown in the figure below:
Then we open the corresponding folder according to the python path value in the PATH variable. As shown in the figure below, all python installation files are inside.
The above is the detailed content of How to check python installation path. For more information, please follow other related articles on the PHP Chinese website!