[英]how do I get python to recognize modules installed in virtual environment?
I'm having trouble getting python in vs code to work properly.我无法让 python 在 vs 代码中正常工作。 There were problems for a while (i dove right in with a workspace folder) so I decided to set up everything from scratch by starting a new project/workspace folder.
有一段时间出现了问题(我直接使用了工作区文件夹),所以我决定通过启动一个新的项目/工作区文件夹从头开始设置所有内容。
so far I've been having a few issues.到目前为止,我遇到了一些问题。 The latest is this: despite creative a virtual environment as instructed on the vs code website, I can't get python to recognize that I've already installed the modules I want to use.
最新的是:尽管按照 vs code 网站上的说明创建了一个虚拟环境,但我无法让 python 识别出我已经安装了我想要使用的模块。
How do I fix this?我该如何解决? (please see attached picture.
(请看附图。
towards the bottom you can see that the virtual environment already has matplotlib, but python wouldn't recognize the module anyway在底部你可以看到虚拟环境已经有 matplotlib,但无论如何 python 都不会识别该模块
TEST
: $python3 -m venv TEST
TEST
的虚拟环境: $python3 -m venv TEST
Command Palette
and type Python: Select Interpreter
Command Palette
并键入Python: Select Interpreter
And then you can choose the location of the desired interpreter (in my case the one from TEST
virtual environment然后您可以选择所需解释器的位置(在我的情况下是来自
TEST
虚拟环境的解释器
TEST
envTEST
env Bash重击
From Cmd/Powershell normally you should run:从 Cmd/Powershell 通常你应该运行:
TEST\Scripts\activate.bat
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.