[英]vscode doesn't seem to activate my virtual python environment
I have some python code that I wrote and have just installed vscode and starting to work with it.我有一些我编写的 python 代码,并且刚刚安装了 vscode 并开始使用它。
the code is in home/user/code/dlS3BMC folder which has a env folder with my virtual environment.代码位于 home/user/code/dlS3BMC 文件夹中,其中有一个包含我的虚拟环境的 env 文件夹。 I am using Linux Mint 19.3 Tricia cinnamon desktop, vscode 1.41.1
我正在使用 Linux Mint 19.3 Tricia cinnamon 桌面,vscode 1.41.1
I open this folder in vscode.我在 vscode 中打开这个文件夹。 ctrl+ shft+p and I see my virtual environment, I select it, but when I do which python in the terminal window it is still pointing to the system python /usr/bin/python
ctrl+ shft+p 我看到了我的虚拟环境,我选择了它,但是当我在终端窗口中执行 which python 时它仍然指向系统 python /usr/bin/python
If I .如果我 。 env/bin/activate in the terminal everything works fine - I don't mind doing that but it would be nice if I didn't have to.
env/bin/activate 在终端中一切正常 - 我不介意这样做,但如果我不必这样做会很好。
From the microsoft docs I think it is supposed to automatically activate the env, but it does not.从 microsoft docs 我认为它应该自动激活 env,但它没有。 I have tried saving project after I activate, but when I close and open again, it is not activated.
我在激活后尝试保存项目,但是当我关闭并再次打开时,它没有被激活。 Sorry I am very new to vscode at this stage and have just used sublime text editor to write my python code in the past.
抱歉,我在现阶段对 vscode 还很陌生,过去刚刚使用 sublime 文本编辑器编写了我的 python 代码。
Thanks Bill谢谢比尔
ok, it seems it does not activate the virtual environment until you run the code either debug or simply run... when you run the code, I can see it activate the env.好的,它似乎不会激活虚拟环境,直到您运行代码调试或只是运行...当您运行代码时,我可以看到它激活了环境。
TIL this.直到这个。
Regards Bill问候比尔
This is a known issue in VS Code (still... nearly 2 years later).这是 VS Code 中的一个已知问题(仍然......近 2 年后)。 If you would like to see it fixed, you can give the VSCode Github issue a "thumbsup".
如果你想看到它被修复,你可以给VSCode Github 问题一个“拇指”。 If it reaches 20 before Jan 10th, it'll be added to their development roadmap
如果在 1 月 10 日之前达到 20,它将被添加到他们的发展路线图
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.