【发布时间】:2017-11-05 19:18:06
【问题描述】:
在调试它继续使用 Python2 时,我似乎无法让 Python3 工作。我已经尝试了一些东西,但仍然无法让它工作。我验证了 Python3s 路径是 /usr/local/bin/python3 每次我运行一个脚本到 by
import sys
print(sys.version)
我仍然得到 2.7.10 python 3 已安装并正常工作。
我的 launch.json 和 settings.json 中有这个(类型和请求在 launch.json 中由于某种原因都是灰色的)
{
"name": "Python",
"type": "python",
"request": "launch",
"stopOnEntry": true,
"program": "${file}",
"pythonPath": "/usr/local/bin/python3",
"debugOptions": [
"WaitOnAbnormalExit",
"WaitOnNormalExit",
"RedirectOutput"
] }
【问题讨论】:
-
我对 Visual Studio Code 不是很熟悉,但
pythonPath通常是您的 python lib 文件夹的路径,而不是您的 python 可执行文件的路径? -
你是如何在 VS Code 中运行程序的?我有一个调试配置设置为使用我在单独文件夹中的 virtualenv 中的 python 二进制文件。但是,如果我在终端(甚至在代码中)运行
which python,它会将我指向我的 /usr/local/bin/python。
标签: python json macos python-3.x visual-studio-code