Home  >  Article  >  Backend Development  >  How to check python installation path

How to check python installation path

爱喝马黛茶的安东尼
爱喝马黛茶的安东尼Original
2019-06-13 16:43:0038521browse

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.

How to check python installation path

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.

How to check python installation path

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"

How to check python installation path

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

How to check python installation path

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.

How to check python installation path

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:

How to check python installation path

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:

How to check python installation path

How to check python installation path

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

How to check python installation path

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:

How to check python installation path

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.

How to check python installation path

Then click Advanced System Settings on the right side of the Computer Properties page, as shown in the picture below:

How to check python installation path

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.

How to check python installation path

How to check python installation path

In the opened PATH variable, we can clearly see the installation path of python, as shown in the figure below:

How to check python installation path

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.

How to check python installation path

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn