如何修复找不到默认Python错误(&C)

2022-03-25 00:00:00 python python-3.x python-3.6

问题描述

我在Windows服务器(64位)上使用的是python,它是由另一个用户安装在C:useruserxAppDataLocalProgramsPythonPython36中他自己的目录中的

所有其他用户(不包括我)都可以在此服务器上运行Python文件。当我运行一个Python程序时,我得到以下错误:

C:Usersuser xAppDataLocalProgramsPythonPython36>test.py
launcher build: 32bit
launcher executable: Console
File 'C:Usersmy userAppDataLocalpy.ini' non-existent
File 'C:Windowspy.ini' non-existent
Called with command line: "C:Usersuser xAppDataLocalProgramsPythonPython
36	est.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在命令行中运行代码,结果显示以下错误。


解决方案

我找到解决方案了:

在cmd中设置全局变量解决了此问题

C:>ftype Python="C:Usersuser xAppDataLocalProgramsPython36python.exe%1%*"

相关文章