英文:
Why python interpreter not using venv
问题
I set up virtual env in my pycharm and i have interpreter of python in that venv and my console shows me that im using that but for some reason i still have packages of my main interpreter
我在PyCharm中设置了虚拟环境,并且在该虚拟环境中有Python解释器,我的控制台显示我正在使用它,但出于某种原因,我仍然拥有我的主要解释器的包。
How can i solve that?
我该如何解决这个问题?
This is my venv interpreter and im using it
这是我的虚拟环境解释器,我正在使用它
But for some reason in terminal i still has previous intrepreter from another project
但出于某种原因,在终端中,我仍然拥有来自另一个项目的先前解释器。
英文:
I set up virtual env in my pycharm and i have interpreter of python in that venv and my console shows me that im using that but for some reason i still have packages of my main interpreter
How can i solve that?
This is my venv interpreter and im using it
But for some reason in terminal i still has previous intrepreter from another project
答案1
得分: 2
在该终端中,您可以运行 which python3
(在 Python REPL 外)。您应该看到它不是您的桌面文件夹的 venv python...
您需要使用 cmd.exe
作为终端。然后在运行 py3
/python3
或 pip
命令之前,需要调用该文件夹中 venv 的 activate.bat
文件。
否则,使用 Pycharm 内置的 pip 管理对话框,它应该自动链接到项目解释器,而不是修改 PyCharm 终端设置以适用于所有项目。
英文:
In that terminal, you can run which python3
(outside of the Python REPL). You should see it's not your Desktop folder's venv python...
You need to use cmd.exe
for the terminal. Then you need to invoke the activate.bat
file of the venv in that folder before running py3
/python3
or pip
commands.
Otherwise, use Pycharm's built-in pip management dialog which should automatically link to the project interpreter, rather than modify PyCharm terminal settings for all projects.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论