Visual studio code &引用;“未解决的进口”-错误:在VSCode中包含代码完成路径和pylint
为了让代码完成并运行linting,我希望VSCode包含一个特定的路径Visual studio code &引用;“未解决的进口”-错误:在VSCode中包含代码完成路径和pylint,visual-studio-code,Visual Studio Code,为了让代码完成并运行linting,我希望VSCode包含一个特定的路径 https://code.visualstudio.com/docs/python/environments#_environment-变量定义文件 我创建了一个测试环境 $ pwd ==> /Users/stephan/saitc/test_ws $ ls -a ==> . .env tst_pckg ==> .. __init__.py =
https://code.visualstudio.com/docs/python/environments#_environment-变量定义文件
我创建了一个测试环境
$ pwd
==> /Users/stephan/saitc/test_ws
$ ls -a
==> . .env tst_pckg
==> .. __init__.py
==> .DS_Store testing.code-workspace
$ cat .env
==> PYTHONPATH="/Users/stephan/saitc"
$ ls tst_pckg/
==> CONST.py __init__.py testing.py
$ cat tst_pckg/CONST.py
==> # -*- coding: utf-8 -*-
==>
==> TEST_CONSTANT = "Test constant's value"
$ cat tst_pckg/testing.py
==> # -*- coding: utf-8 -*-
==>
==> from test_ws.tst_pckg.CONST import TEST_CONSTANT
设置“python.envFile”设置为“${workspaceFolder}/.env”
通过此设置,我希望VSCode知道包“test_ws”,但键入以下行:
from test_ws.tst_pckg.CONST import TEST_CONSTANT
在文件中,“testing.py”给出了我没有合理的代码完成,并且“testws.tst_pckg.CONST”无法解析(“未解析的导入”-VSCode ui中的错误)
我在macos上使用Anaconda和它附带的Visual Studio代码1.30.1。是否必须从目录“/Users/stephan/saitc/test_ws”启动visual studio代码?(如果是,怎么做?)
每次启动VisualStudio代码时,都会有人问我是否要启动pylint扩展。我怎样才能永久打开它?(Python›Linting:Pylint已启用,Python›Linting:Enabled)
谢谢,
Stephan您可以使用配置
“python.autoComplete.extrapath”:[“/your source/folder”]
据我所知,env文件仅用于启动终端等,而不用于扩展。我认为这个问题与