我为python安装了cocos2d,示例运行良好
但是,当我将python文件移到我在Visual Studio代码中选择的文件夹中时,这只是说它找不到名为cocos的模块。
我想我需要更改launch.json中的设置,但我不知道如何。
我将仅上传launch.json文件的一部分。
{
"version": "0.2.0",
"configurations": [
{
"name": "Python",
"type": "python",
"request": "launch",
"stopOnEntry": true,
"pythonPath": "C:/Users/Sanghun/AppData/Local/Programs/Python/Python35-32/python.exe",
"program": "${file}",
"debugOptions": [
"WaitOnAbnormalExit",
"WaitOnNormalExit",
"RedirectOutput"
]
},
您将需要修改settings.json中的python.pythonPath设置,以指向此解释器,如下所示: "python.pythonPath":"C:/Users/Sanghun/AppData/Local/Programs/Python/Python35-32/python.exe"
或者,您可以启动命令“选择工作区解释器”(https://github.com/DonJayamanne/pythonVSCode/wiki/Python-Path-and-Version#selecting-an-interpreter)
最后一点,您可能需要将launch.json中的更改还原为以下内容(避免您必须在两个位置指定路径): "pythonPath": "${config.python.pythonPath}",
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句