Home Backend Development Python Tutorial How to check python installation path

How to check python installation path

Jun 13, 2019 pm 04:43 PM
linux python windows 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.

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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

PHP and Python: Different Paradigms Explained PHP and Python: Different Paradigms Explained Apr 18, 2025 am 12:26 AM

PHP is mainly procedural programming, but also supports object-oriented programming (OOP); Python supports a variety of paradigms, including OOP, functional and procedural programming. PHP is suitable for web development, and Python is suitable for a variety of applications such as data analysis and machine learning.

Choosing Between PHP and Python: A Guide Choosing Between PHP and Python: A Guide Apr 18, 2025 am 12:24 AM

PHP is suitable for web development and rapid prototyping, and Python is suitable for data science and machine learning. 1.PHP is used for dynamic web development, with simple syntax and suitable for rapid development. 2. Python has concise syntax, is suitable for multiple fields, and has a strong library ecosystem.

PHP and Python: A Deep Dive into Their History PHP and Python: A Deep Dive into Their History Apr 18, 2025 am 12:25 AM

PHP originated in 1994 and was developed by RasmusLerdorf. It was originally used to track website visitors and gradually evolved into a server-side scripting language and was widely used in web development. Python was developed by Guidovan Rossum in the late 1980s and was first released in 1991. It emphasizes code readability and simplicity, and is suitable for scientific computing, data analysis and other fields.

How to run java code in notepad How to run java code in notepad Apr 16, 2025 pm 07:39 PM

Although Notepad cannot run Java code directly, it can be achieved by using other tools: using the command line compiler (javac) to generate a bytecode file (filename.class). Use the Java interpreter (java) to interpret bytecode, execute the code, and output the result.

How to run python with notepad How to run python with notepad Apr 16, 2025 pm 07:33 PM

Running Python code in Notepad requires the Python executable and NppExec plug-in to be installed. After installing Python and adding PATH to it, configure the command "python" and the parameter "{CURRENT_DIRECTORY}{FILE_NAME}" in the NppExec plug-in to run Python code in Notepad through the shortcut key "F6".

How to check the warehouse address of git How to check the warehouse address of git Apr 17, 2025 pm 01:54 PM

To view the Git repository address, perform the following steps: 1. Open the command line and navigate to the repository directory; 2. Run the "git remote -v" command; 3. View the repository name in the output and its corresponding address.

Golang vs. Python: Key Differences and Similarities Golang vs. Python: Key Differences and Similarities Apr 17, 2025 am 12:15 AM

Golang and Python each have their own advantages: Golang is suitable for high performance and concurrent programming, while Python is suitable for data science and web development. Golang is known for its concurrency model and efficient performance, while Python is known for its concise syntax and rich library ecosystem.

Python vs. C  : Learning Curves and Ease of Use Python vs. C : Learning Curves and Ease of Use Apr 19, 2025 am 12:20 AM

Python is easier to learn and use, while C is more powerful but complex. 1. Python syntax is concise and suitable for beginners. Dynamic typing and automatic memory management make it easy to use, but may cause runtime errors. 2.C provides low-level control and advanced features, suitable for high-performance applications, but has a high learning threshold and requires manual memory and type safety management.

See all articles