How can I find where Python is installed on Window

2020-01-25 12:59发布

I want to find out my Python installation path on Windows. For example:

C:\Python25

How can I find where Python is installed?

16条回答
家丑人穷心不美
2楼-- · 2020-01-25 13:08

Go to C:\Users\USER\AppData\Local\Programs\Python\Python36 if it is not there then open console by windows+^R Then type cmd and hit enter type python if installed in your local file it will show you its version from there type the following import os import sys os.path.dirname(sys.executable)

查看更多
The star\"
3楼-- · 2020-01-25 13:09

If you use anaconda navigator on windows, you can go too enviornments and scroll over the enviornments, the root enviorment will indicate where it is installed. It can help if you want to use this enviorment when you need to connect this to other applications, where you want to integrate some python code.

查看更多
倾城 Initia
4楼-- · 2020-01-25 13:09

If you have the py command installed, which you likely do, then just use the --list-paths argument to the command:

py --list-paths

Example output:

Installed Pythons found by py Launcher for Windows
-3.8-32 C:\Users\cscott\AppData\Local\Programs\Python\Python38-32\python.exe *
-2.7-64 C:\Python27\python.exe

The * indicates the currently active version for scripts executed using the py command.

查看更多
ら.Afraid
5楼-- · 2020-01-25 13:12

If you need to know the installed path under Windows without starting the python interpreter, have a look in the Windows registry.

Each installed Python version will have a registry key in either:

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

In 64-bit Windows, it will be under the Wow6432Node key:

  • HKLM\SOFTWARE\Wow6432Node\Python\PythonCore\versionnumber\InstallPath
查看更多
可以哭但决不认输i
6楼-- · 2020-01-25 13:12

To know where Python is installed you can execute where python in your cmd.exe.

查看更多
唯我独甜
7楼-- · 2020-01-25 13:15

I installed 2 and 3 and had the same problem finding 3. Fortunately, typing path at the windows path let me find where I had installed it. The path was an option when I installed Python which I just forgot. If you didn't select setting the path when you installed Python 3 that probably won't work - unless you manually updated the path when you installed it. In my case it was at c:\Program Files\Python37\python.exe

查看更多
登录 后发表回答