1

I'm setting up PyCharm for my app development and have encountered a strange issue. Even though I set my project to use the very same virtual environment (I used the built-in venv) and made sure PyCharm's interpreter points to the same path, the versions of Python are different.

Everything I googled up was someone's not setting the interpreter inside PyCharm correctly. I also checked PyCharm's guide and haven't found anything that I haven't already tried.

These are the results from the Terminal (I'm using Linux Mint 19), inside my venv:

(venv) x:~/Programming/Shopping_Tracker$ python --version
Python 3.6.7

(venv) x:~/Programming/Shopping_Tracker$ which python
/home/anna/Programming/Shopping_Tracker/venv/bin/python

And these are from PyCharm's Terminal:

(venv) python --version
Python 3.7.3

(venv) which python
/home/anna/Programming/Shopping_Tracker/venv/bin/python

So the versions should be the same to my understanding.

Has anyone encountered a similar issue?

Neb
  • 2,270
  • 1
  • 12
  • 22
  • This is inherent to the use of virtual environments. You can have python 3.7 installed, and use python 3.6 in a virtual environment. Have a look at: https://stackoverflow.com/questions/52138280/easiest-way-to-use-python-3-6-and-3-7-on-same-computer – ma3oun May 05 '19 at 08:55
  • There's also a problem with `which` though I believe it's uncommon these days. Does `type -all python` produce different results for you? – tripleee May 05 '19 at 09:41
  • Moreover, is `venv/bin/python` an actual Python executable, or a wrapper of some sort? If you have something like `pyenv` underneath, you could end up with the latter. – tripleee May 05 '19 at 09:43
  • @tripleee type -all python produces different results actually: OS Terminal: python is /home/anna/Programming/Shopping_Tracker/venv/bin/python python is /usr/bin/python PyCharm Terminal: python is /home/anna/Programming/Shopping_Tracker/venv/bin/python python is /app/bin/python python is /usr/bin/python venv/python/python is of type "Link to Program (application/x-executable)". – Damian Piatkowski May 05 '19 at 10:42
  • @ma3oun thanks for the comment. I understand how virtual envs work, here actually I want to have the same version in the venv and don't understand why PyCharm produces a different one. – Damian Piatkowski May 05 '19 at 10:47
  • @tripleee I mean **venv/bin/python** is of type "Link to Program (application/x-executable)". – Damian Piatkowski May 05 '19 at 10:50

0 Answers0