Visual studio code 如何加载python扩展

Visual studio code 如何加载python扩展,visual-studio-code,dbt,Visual Studio Code,Dbt,在一个dbt数据构建工具项目中,我安装了一个安装了dbt的python虚拟环境,并且希望虚拟环境在vscode中被python扩展激活。但是,在vscode中打开.py文件之前,扩展名似乎不会加载。作为dbt项目,没有.py文件 作为解决方法,我创建了一个空的.py文件来加载扩展名。是否有其他方法可以做到这一点,最好是在这个特定工作区的vscode启动时?谢谢我发现最近的一件事是按如下方式设置您的目录: dbt-project-dir | .vscode >

在一个dbt数据构建工具项目中,我安装了一个安装了dbt的python虚拟环境,并且希望虚拟环境在vscode中被python扩展激活。但是,在vscode中打开.py文件之前,扩展名似乎不会加载。作为dbt项目,没有.py文件


作为解决方法,我创建了一个空的.py文件来加载扩展名。是否有其他方法可以做到这一点,最好是在这个特定工作区的vscode启动时?谢谢

我发现最近的一件事是按如下方式设置您的目录:

dbt-project-dir
       | .vscode
         > settings.json
       | analysis
       | data
       | macros
       | models
       | tests
       .gitignore
       dbt_project.yml
       README.md
其中settings.json的内容为:

{
    "python.pythonPath": "C:\\tools\\miniconda3\\envs\\dbt\\python.exe"
}
然后,从那里打开python文件或使用命令调色板选择解释器(与普通解释器类似),以便通过python扩展激活您的环境:

然后通过文件菜单将工作区保存到.vscode目录


到目前为止,我已经做到了这一点-我仍在尝试使用alias launch run标志将命令传递给

我猜您希望加载virtualenv,以便从vscode shell执行dbt作业。用户可以将virtualenv目录添加到他们的系统路径中,而不是欺骗vscode将virtualenv添加到应用程序的pythonpath中。如果他们这样做了,那么dbt也会指向virtualenv中的可执行文件,而不管env是否已加载

我还可以问一下你打算用这个做什么吗。这可能有助于找到更好的答案

It seems that I myself am the exception to the rule for almost all 'simple' installation procedures. For some reason, it WAS a path related issue:

I ran brew info python, which outputted a lot of information. At the bottom I found this:

Executable python scripts will be put in:
/usr/local/share/python
so you may want to put "/usr/local/share/python" in your PATH, too.
I added that to my PATH in /etc/launchd.conf and ~/.bashrc and lo and behold:

$ which virtualenv 
tells me:

"/usr/local/share/python/virtualenv"
I still don't know why I couldn't find any pointers in the right direction, online, anywhere? Is pip install virtualenv supposed to add to the PATH itself? If so, why not on my system? Why did @bibhas tell me explicitly it was not a path issue?
感谢FishTown Analytics的@drew在这方面的帮助