【发布时间】:2020-09-23 11:29:12
【问题描述】:
这是我的 VS 代码信息:
Version: 1.43.2 (user setup)
Commit: 0ba0ca52957102ca3527cf479571617f0de6ed50
Date: 2020-03-24T07:38:38.248Z
Electron: 7.1.11
Chrome: 78.0.3904.130
Node.js: 12.8.1
V8: 7.8.279.23-electron.0
OS: Windows_NT x64 10.0.17763
我的python路径在这里:
/auto/energymdl2/anaconda3/envs/commod_py3_20200921/bin/python
但 VS 代码在我选择后仍然在状态栏中显示 Select Python Interpreter。
但是当我尝试选择时,它说它已经被选中。目前,由于这个原因,我无法使用 Python linter Flake8。
当我检查控制台日志时。我得到了以下内容。
Error Python Extension: 2020-09-23 05:02:01: Failed to parse interpreter information for /auto/energymdl2/anaconda3/envs/commod_py3_20200921/bin/python,/home/test/.vscode-server/extensions/ms-python.python-2020.5.86806/pythonFiles/pyvsc-run-isolated.py,/home/test/.vscode-server/extensions/ms-python.python-2020.5.86806/pythonFiles/interpreterInfo.py stderr: Error in sitecustomize; set PYTHONVERBOSE for traceback:ModuleNotFoundError: No module named 'sdlc'
但是当我进入 Python 并导入 sdlc 时。我能够。 Python/iPython 路径:
/auto/energymdl2/anaconda3/envs/commod_py3_20200921/bin/python
{
"python.linting.pycodestyleEnabled": false,
"python.linting.flake8Enabled": true,
"python.linting.enabled": true,
"python.linting.flake8Args": [
"--ignore=W605",
"--ignore=W503",
"--ignore=W605",
"--max-line-length=120"
],
"python.linting.banditEnabled": false,
"python.pythonPath": "/auto/energymdl2/anaconda3/envs/commod_py3_20200921/bin/python",
// "python.condaPath": "/auto/energymdl2/anaconda3/envs/commod_py3_20200727/bin/python"
}
【问题讨论】:
-
1.在您的工作区中,您应该有一个
.vscode文件夹和一个.settings文件(名称可能有点不同,请从内存中回忆)。应该说你使用的python解释器路径是什么。 2.您安装了多个python版本。您可以使用which python(或which ipython)检查您的python 解释器的路径。在您的 VSC 突击队(第二张图片)中选择“输入解释器路径...” -
刚刚添加了 .json 和 python 路径。是的,我安装了多个 python 解释器。但路径是正确的。它以前工作正常。
-
您咨询过相关documentation吗?如果我理解正确,
python.condaPath应该是 Conda 可执行文件 的路径,而不是环境中的 Python 安装。将python.pythonPath设置为环境中的Python 也可能不足以使其正常工作。 -
@AMC 是的,我指的是可执行文件。我想你可能指的是 python.exe 文件?这就是理解 Windows。在 Linux 中,它只是 python。
-
我想你可能指的是 python.exe 文件?这就是理解 Windows。在 Linux 中,它只是 python。 你指的是我评论的哪一部分?
标签: python linux visual-studio-code anaconda