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

You can search for the "environmental variable for you account". If you have added the Python in the path, it'll show as "path" in your environmental variable account.

but almost always you will find it in "C:\Users\%User_name%\AppData\Local\Programs\Python\Python_version"

the 'AppData' folder may be hidden, make it visible from the view section of toolbar.

查看更多
贪生不怕死
3楼-- · 2020-01-25 13:30

In the sys package, you can find a lot of useful information about your installation:

import sys
print sys.executable
print sys.exec_prefix

I'm not sure what this will give on your Windows system, but on my Mac executable points to the Python binary and exec_prefix to the installation root.

You could also try this for inspecting your sys module:

import sys
for k,v in sys.__dict__.items():
    if not callable(v):
        print "%20s: %s" % (k,repr(v))
查看更多
放荡不羁爱自由
4楼-- · 2020-01-25 13:31

If You want the Path After successful installation then first open you CMD and type python or python -i

It Will Open interactive shell for You and Then type

import sys

sys.executable

Hit enter and you will get path where your python is installed ...

查看更多
啃猪蹄的小仙女
5楼-- · 2020-01-25 13:33

If you have python in your enviroment variable then you can use the following command in cmd:

>>> where python

or for unix enviroment

>>> which python

command line image

查看更多
登录 后发表回答