Pycharm python version in terminal

已回答

Hello, below is what I execute in Pycharm Terminal:

why is my version of python is python 3.7.7, but terminal still use python2 to import package?

 

I also set python 3.7 as the project interpreter. Can somebody advise how to solve this issue?

 

0

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.

0

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.

0

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.

0

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 ...

0

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?

1

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.

0

请先登录再写评论。