Home > Article > Backend Development > How to find the python installation path
How to find the python installation path?
When using python, sometimes you need to find the installation location of the python package and find other installed third-party packages. Let's take a look at how to find the installation path of python on the Linux platform.
View on Linux platform
For the Linux platform, many running system software are based on python. If python goes wrong, then The entire system may be at risk of major problems.
We 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 results are as follows, you can see The path is /usr/bin/python
## Then we can use this command to find out which installation package it has. The command is: rpm - qf /usr/bin/pythonThe result is as shown in the picture below. You can see that the installation package is python-2.7.5 Then we You can find the installation paths of all files in the python installation package. The command to query the path of all files in the installation package is: rpm -ql python-2.7.5 as shown below As shown in, 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 commandrpm -ql python-libsThe corresponding results will all come out, as shown in the second picture below: If you install a lot of third-party library files, then 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 foundThe above is the detailed content of How to find the python installation path. For more information, please follow other related articles on the PHP Chinese website!