我似乎无法在调试时使用Python3,它继续使用Python2。我尝试了一些方法,但仍无法使其正常工作。我验证了Python3的路径为/usr/local/bin/python3。每次运行脚本时
import sys
print(sys.version)
我仍在使用2.7.10版本的Python,同时3.x版本也已经安装并正常工作。
我的launch.json和settings.json中都有以下配置(type和request在launch.json中被禁用了):
{
"name": "Python",
"type": "python",
"request": "launch",
"stopOnEntry": true,
"program": "${file}",
"pythonPath": "/usr/local/bin/python3",
"debugOptions": [
"WaitOnAbnormalExit",
"WaitOnNormalExit",
"RedirectOutput"
] }
pythonPath
通常应该是指向你的Python库文件夹的路径,而不是你的Python可执行文件的路径吧? - wmorrellwhich python
,它会指向我的/usr/local/bin/python。 - Luke Tully