Abhinav
Abhinav

Reputation: 1962

PyCharm not using correct Python version/interpreter

I am facing a strange issue in PyCharm. I have defined a virtual environment "(venv)" having Python3.8 as base as interpreter for project along with rest of packages required for the project. The same is selected in project run/debug configuration as well. See pictures below.

Virtual Environment set for project

Virtual Environment set for Run/Debug configs

My virtual environment has Python-3.8, however, when I try to run project, it tries to run the project with Python-3.7 present elsewhere in the PC. Here is that pic : PyCharm call after pressing Run button

Furthermore, the interpreter listed in PyCharm at bottom right of the screen is correct as shown in figure: enter image description here

I have seen a similar question answered here: PyCharm not using my configured virtualenv interpreter however the remedy suggested there doesn't work for me.

Upvotes: 1

Views: 1927

Answers (1)

Abhinav
Abhinav

Reputation: 1962

After help from a lot of colleagues at work, I finally found the bugger. In the Run/Debug configuration, there is a checkbox saying "include parent environment variables" checkbox which was checked in my case. And that was the problem. For this reason, the virtual environment interpreter was being over-ridden. This checkbox can be found as shown in images below :

enter image description here

enter image description here

Upvotes: 2

Related Questions