Where is python exe

How Can I Find Where Python is Installed on Windows

Python is one of the most well-known, all-purpose, and straightforward programming language that is used by a programmer all across the world. It can be utilized in many applications, projects, websites, and APIs. Sometimes, we need to check Python packages or modules from the path where Python is installed.

In this article, we will demonstrate methods to find the path where Python is installed on Windows:

Method 1: Find Where Python is Installed on Windows Using Command Prompt

To find out where Python is installed using Windows Command Prompt, follow the below-listed examples.

Example 1: Using “where” Command
First use the “where” command to print out the path of the Python installed directory:

As you can see, the output fetched the required path and displayed on Command Prompt:

Example 2: Execute py Command
The “py” command can also be utilized with the “–list-paths” option to list the Python path:

Let’s check out the second method.

Method 2: Find Where Python is Installed on Windows Using Startup Menu

To find where Python is installed using the “Startup” menu, follow the below-mentioned procedure.

First, search for “Python.exe” in the “Startup” menu. Then, select the “Open file location” option to open the related folder:

As a result, you will be navigated towards the directory where Python is installed:

Let’s check out the third method to find out the location of Python.

Method 3: Find Where Python is Installed on Windows Using Environment Variable Settings

To check out the location where the Python is installed using the PATH environment variable, follow the mentioned steps.

Step 1: Open Advanced System Settings

Press “Window+I” to open the system Settings. Then, select the “System” from the list of available categories:

Читайте также:  Create mapping in java

Search for “Advanced system settings” in the search bar and open it:

Step 2: Open Environment Variables

After opening the System system, click on the “Environment Variables” button:

Step 3: Open Path Environment Variable
Under the “System Variables” tab, choose “Path” and press the “Edit” button to view the path details:

From the Path Environment Variable, you can find the location where the Python is installed as shown below:

We have compiled the different methods to find out where Python is installed on Windows.

Conclusion

There are many ways to find out where Python is installed such as using Command Prompt, Startup menu, and System Environment Variables. For the first approach, open the Command Prompt and utilize the “where python” command. In the second approach, search “python.exe” in the “Startup” menu and open the file location. In the third approach, you can find out Python location through the “Path” Environment Variable. We have illustrated the different methods to locate where Python is installed on Windows.

About the author

Rafia Zafar

I am graduated in computer science. I am a junior technical author here and passionate about Programming and learning new technologies. I have worked in JAVA, HTML 5, CSS3, Bootstrap, and PHP.

Источник

Как узнать, где установлен Python в Windows?

Иногда нам нужно проверить пакеты или модули в том месте, где установлен Python. В этой статье мы покажем три способа, как найти папку в которой установлен Python в Windows:

  • с помощью командной строки
  • через меню “Пуск
  • используя параметры переменной среды

Как найти место установки Python в Windows с помощью командной строки

Примечание редакции: о собственно установке Python читайте в статье “Как установить Python на Windows 10 или 11”.

Чтобы узнать, где установлен Python, используя командную строку Windows, следуйте приведенным ниже примерам.

Пример 1: команда where

Для начала попробуйте использовать команду where , чтобы вывести путь к директории установленного Python:

Как видите, в результате нужный путь был найден и отображен в командной строке:

Использование where в командной строке. На следующей строке после введенной команды выведен путь, по которому в Windows установлен Python

Пример 2: команда py

Команда py с опцией —list-paths также может быть использована для перечисления путей к Python:

Использование команды py --list-paths в командной строке

Как найти место установки Python в Windows с помощью меню “Пуск”

Чтобы найти, где установлен Python, используя меню “Пуск”, выполните следующую процедуру.

Сначала найдите файл “Python.exe” в меню “Пуск”. Затем выберите опцию “Открыть расположение файла”, чтобы открыть соответствующую папку:

Опция

В результате вы будете перемещены в каталог, где установлен Python:

Каталог, где установлен Python

Как найти место установки Python в Windows с помощью переменной окружения

Чтобы узнать, где установлен Python, используя переменную окружения PATH , выполните следующие действия.

Шаг 1. Откройте расширенные системные настройки

Нажмите Window+I , чтобы открыть Настройки системы. Затем выберите “Система” из списка доступных категорий:

Читайте также:  What is json array in java

Окно настроек

Найдите в строке поиска “Дополнительные параметры системы” и откройте их:

Дополнительные параметры системы

Шаг 2. Откройте переменные среды

В Дополнительных параметрах системы нажмите на кнопку “Переменные среды”:

Переменные среды

Шаг 3. Откройте переменную среды Path

На вкладке “Системные переменные” выберите “Path” и нажмите кнопку “Изменить” для просмотра сведений о пути:

Вкладка

Из переменной среды Path можно найти место, где установлен Python, как показано ниже:

Окно редактирования переменной окружения с выделенным путем к Python

Заключение

Узнать, где в Windows установлен Python, можно разными способами, например, с помощью командной строки, меню “Пуск” и системных переменных среды.

Для первого способа откройте командную строку и воспользуйтесь командой where python . Во втором случае найдите “python.exe” в меню “Пуск” и откройте местоположение файла. При третьем подходе вы можете узнать расположение Python через переменную среды “Path”.

Источник

How to Find Path Where Python is Installed on Windows?

Be on the Right Side of Change

Windows normally installs Python on one of the two locations:

For me, it’s the latter. For you, it may be different—this article shows you how to check for yourself! 🙂

For your convenience, I’ve made a short gif that shows how I rushed through the code on my Windows machine:

Before you start, you may want to ask yourself the following question:

  • Do you have access to a Python interpreter/shell?
  • Do you have access to the command-line or PowerShell?
  • Do you have neither?

Do You Have Access to a Python Shell?

To get the installation path in a human-readable format, run the following two lines in your Python shell:

  1. Import the os and sys libraries with the command: import os, sys
  2. Print the path to the shell using the command: print(os.path.dirname(sys.executable))

This is shown in the following code snippet:

import os, sys print(os.path.dirname(sys.executable))

The output on my computer is the following installation path:

'C:\Users\xcent\AppData\Local\Programs\Python\Python39'

You can copy it to the clipboard and use it wherever you need it.

An alternative way is shorter but generates an output that is less desirable with double front-slash path delimiters:

You can see the output in a Python shell on my computer:

import sys print(sys.executable) 'C:\\Users\\xcent\\AppData\\Local\\Programs\\Python\\Python39\\pythonw.exe'

Do You Have Access to the Command-Line or Powershell?

To get the Python installation path under Windows using the command line or PowerShell, you can pack the Python code in a concise and easy-to-copy one-liner command:

python -c "import os, sys; print(os.path.dirname(sys.executable))"

If Python is regularly installed, you can run the python command from any directory in your PowerShell which makes it extra convenient.

Alternatively, you can check your Python installation path in your Windows command-line by using the simple two-word command “ where Python “. Here’s how this works on my Windows machine:

This gives me the following output:

C:\Users\xcent\AppData\Local\Microsoft\WindowsApps\python.exe

You’ll learn an additional trick next that allows you to check your Python installation path without access to the Python interpreter or the windows command line.

Читайте также:  Smartcamp73 ru parents html

But before we move on, I’m excited to present you my new Python book Python One-Liners (Amazon Link).

If you like one-liners, you’ll LOVE the book. It’ll teach you everything there is to know about a single line of Python code. But it’s also an introduction to computer science, data science, machine learning, and algorithms. The universe in a single line of Python!

The book was released in 2020 with the world-class programming book publisher NoStarch Press (San Francisco).

Get Python Installation Path Without Shell

To get the Python installation path on Windows without using either the Python interpreter or the command line, check the Windows registry that contains a key for each installed Python version. Both variants are possible:

  • HKLM\SOFTWARE\Python\PythonCore\versionnumber\InstallPath
  • HKCU\SOFTWARE\Python\PythonCore\versionnumber\InstallPath

If you have a 64-bit Windows version, you can find the Python path under the Wow6432Node key:

You can learn how to use these variants in your code on this post. An even more thorough discussion is provided on the official Python wiki here.

While working as a researcher in distributed systems, Dr. Christian Mayer found his love for teaching computer science students.

To help students reach higher levels of Python success, he founded the programming education website Finxter.com that has taught exponential skills to millions of coders worldwide. He’s the author of the best-selling programming books Python One-Liners (NoStarch 2020), The Art of Clean Code (NoStarch 2022), and The Book of Dash (NoStarch 2022). Chris also coauthored the Coffee Break Python series of self-published books. He’s a computer science enthusiast, freelancer, and owner of one of the top 10 largest Python blogs worldwide.

His passions are writing, reading, and coding. But his greatest passion is to serve aspiring coders through Finxter and help them to boost their skills. You can join his free email academy here.

Be on the Right Side of Change 🚀

  • The world is changing exponentially. Disruptive technologies such as AI, crypto, and automation eliminate entire industries. 🤖
  • Do you feel uncertain and afraid of being replaced by machines, leaving you without money, purpose, or value? Fear not! There a way to not merely survive but thrive in this new world!
  • Finxter is here to help you stay ahead of the curve, so you can keep winning as paradigms shift.

Learning Resources 🧑‍💻

⭐ Boost your skills. Join our free email academy with daily emails teaching exponential with 1000+ tutorials on AI, data science, Python, freelancing, and Blockchain development!

Join the Finxter Academy and unlock access to premium courses 👑 to certify your skills in exponential technologies and programming.

New Finxter Tutorials:

Finxter Categories:

Источник

Оцените статью