Pycharm python version in terminal
4 人关注
已回答
请先登录再写评论。
Please try the following suggestions:
1. `which pip` - should show which pip executable is actually being used. Is it from correct environment?
2. Try reproducing the issue in the terminal outside of IDE - activate the same venv and run the same command.
Often the same issue. As example : clone project from github, and terminal displays (venv) but reporting Python version as system.
in case if create new env not use already existed - no issues.
It's not recommended to copy venv directories from other systems. The best practice is to create a new venv on the machine where you clone the project, and install dependencies using techniques like requirements.txt or other.
I'm not using venv from github. I use venv created on my local machine, connecting it by env selector. In any case if I activate env end run Pycharm by script from terminal where venv activated, it works fine in any scenarios. Main question is why terminal in Pycharm (time to time) displays (venv) but in the same time displays system python version. It easy to manage but ...
Did you move the venv to another directory by any chance? This can be a side effect. Does the same issue reproduce if you create a new venv and set it as project interpreter?
I was having this same issue. The PyCharm Python console was fine, but the PyCharm terminal was using the default system Python binary instead of the venv binary, evene though the terminal showed that the venv was active.
I had in fact renamed the project folder with the existing venv before opening it in PyCharm. After renaming it back and reopening the project, the venv in terminal worked as expected.