Python在我的机器上,我只是不知道在哪里,如果我在终端中输入Python,它会打开Python 2.6.4,这不是在它的默认目录中,肯定有一种方法可以从这里找到它的安装位置?


当前回答

在windows搜索python,然后右键单击“打开文件位置”。我就是这么做的

其他回答

Windows用户:

如果python命令不在您的$PATH环境中。

打开PowerShell并运行这些命令以找到该文件夹

cd \
ls *ython* -Recurse -Directory

这应该会告诉你python安装在哪里

如果你使用的是windows操作系统(我使用的是windows 10),只需输入

where python   

在命令提示符(CMD)中

它将显示您所安装的目录。

要找到Windows上所有的Python安装,在命令提示符处运行:

dir site.py /s

确保您在根驱动器中。你会看到类似这样的东西。

平台独立的解决方案在一条线上

Python 2:

python -c "import sys; print sys.executable"

Python 3:

python -c "import sys; print(sys.executable)"

看看sys.path:

>>> import sys
>>> print(sys.path)