How to find the python installation path

藏色散人
Release: 2019-10-24 09:57:23
Original
7331 people have browsed it

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.

How to find the 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
Copy after login

The results are as follows, you can see The path is /usr/bin/python

How to find the python installation path

## Then we can use this command to find out which installation package it has. The command is:

rpm - qf /usr/bin/python

The result is as shown in the picture below. You can see that the installation package is python-2.7.5

How to find the python installation path

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.

How to find the 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 find the 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 find the python installation path

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 found

How to find the python installation path

The 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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template