[英]Cannot use virtual environment created within Pycharm from outside of the IDE
I am running Pycharm 2019.3 on Linux Ubuntu 18.04 LTS.我在 Linux Ubuntu 18.04 LTS 上运行 Pycharm 2019.3。 I have created a virtual environment for my Pycharm project from within the IDE.
我在 IDE 中为我的 Pycharm 项目创建了一个虚拟环境。 I am able to access the packages from the virtual environment when I run programs from within the IDE.
当我从 IDE 中运行程序时,我能够从虚拟环境访问包。 However, if I activate the virtual environment created from within Pycharm from the terminal (using source venv/bin/activate, resulting in the (venv) prefix on the command line), the packages I added to the virtual environment can no longer be found.
但是,如果我从终端激活从 Pycharm 内部创建的虚拟环境(使用 source venv/bin/activate,导致命令行上有 (venv) 前缀),则无法再找到我添加到虚拟环境中的包. Why is this?
为什么是这样? The (venv) prefix makes me think that I have successfully activated the virtual environment.
(venv) 前缀让我觉得我已经成功激活了虚拟环境。 What can I do to use this virtual environment outside of Pycharm?
如何在 Pycharm 之外使用这个虚拟环境?
I think this is because pycharm has created a virtual environment in a different location.我认为这是因为 pycharm 在不同的位置创建了一个虚拟环境。 I think you can check both the locations with
echo $VIRTUAL_ENV
and check if they are the same.我认为您可以使用
echo $VIRTUAL_ENV
检查这两个位置并检查它们是否相同。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.