vscode 找不到 tensorflow 即使 python 解释器可以找到它

问题描述

我有一个安装了 tensorflow 的虚拟环境。我可以通过激活虚拟环境并运行 python 解释器来验证这一点。导入在那里工作,但是当我打开 vscode 并激活 venv(从终端窗口和 ctrl-shift p select python 解释器)时,导入失败。无论我是否有launch.json 和settings.json,都会发生这种情况。这些配置文件的当前内容是:

settings.json:

 "env": {"PYTHONPATH": "${workspaceRoot}"},

launch.json:

{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information,visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0","configurations": [
        {
            "name": "Python: Current File","type": "python","request": "launch","program": "${file}","console": "integratedTerminal","env": {"PYTHONPATH": "/home/anna_user2/DropBox/projects/Bishop/python/venv/bin/python"},}
    ]
}

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)