我在 Windows 服务器(64 位)中使用 python,它由另一个用户安装在他自己的目录中 C:\user\userx\AppData\Local\Programs\Python\Python36
所有其他用户(不包括我)都能够在此服务器上运行 Python 文件。运行 Python 程序时出现以下错误:
C:\Users\user x\AppData\Local\Programs\Python\Python36>test.py
launcher build: 32bit
launcher executable: Console
File 'C:\Users\my user\AppData\Local\py.ini' non-existent
File 'C:\Windows\py.ini' non-existent
Called with command line: "C:\Users\user x\AppData\Local\Programs\Python\Python
36\test.py"
maybe_handle_shebang: read 12 bytes
maybe_handle_shebang: BOM not found, using UTF-8
locating Pythons in 64bit registry
locate_pythons_for_key: unable to open PythonCore key in HKCU
locate_pythons_for_key: unable to open PythonCore key in HKLM
locating Pythons in native registry
locate_pythons_for_key: unable to open PythonCore key in HKCU
locate_pythons_for_key: unable to open PythonCore key in HKLM
found no configured value for 'python'
search for default Python found no interpreter
Can't find a default Python.
我尝试在命令行中使用 set pylaunch_debug=1
运行我的代码,它显示以下错误。
原文由 mahsa-ebrahimian 发布,翻译遵循 CC BY-SA 4.0 许可协议
我找到了解决方案:
如下在cmd中设置全局变量解决了这个问题
C:> ftype Python=“C:\Users\user x\AppData\Local\Programs\Python\Python36\python.exe %1 %*”