2016-09-24 127 views
0

我安裝了cocos2d的Python和樣品行之有效蟒蛇,導入模塊VS代碼

但是當我移動蟒蛇文件到我在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" 
     ] 
    }, 

回答

1

您將需要修改python.pythonPath設置在settings.json指向這個解釋如下: "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}",