无法在 windows 中启动 python

Unable to start python in windows

之前我使用 chocolatey 安装了 Python 3.5,但是当我发现我需要使用的库只允许用于 Python 版本 2 - 我卸载了 Python 3.5然后从控制面板安装 Python 2.7.3。

我确保我为 Python -

正确设置了 PATH 变量
PATH=....;C:\Python27

但是当我从提示中调用 python 时仍然出现以下错误:

C:\>python 
Cannot find file at '..\lib\python3\tools\python.exe' 
(C:\ProgramData\chocolatey\lib\python3\tools\python.exe). This usually 
indicates a missing or moved file. 

如何设置巧克力包管理器问题已解决?

检查列出的环境变量 here 是否具有正确的值。

例如

C:\>set PYTHONHOME=C:\Python27

Cannot find file at '..\lib\python3\tools\python.exe'

您确定已将 Python 2.7.3 安装到此文件夹中吗?

...\python3\ ...

您只需要将该路径更改为

'..\lib\python2\tools\python.exe'

我有 运行 chocolatey uninstall python 并在控制面板中的其他 python 版本中卸载后遇到了同样的问题。我能够通过从 chocolatey bin 目录 (C:\ProgramData\Chocolatey\bin) 中删除 python.exe 和 pythonw.exe 来解决它。

del C:\ProgramData\Chocolatey\bin\pytho*.exe

希望对您有所帮助!

您必须将 python 2 添加到您的路径中。 如果您确定已完成此操作,请重新启动计算机以确保它使用正确的路径变量。