The problem I am facing is similar to this: PyCharm not using my configured virtualenv interpreter
I am trying to run a python module in PyCharm in a virtual environment. I have set up the correct Project Interpreter and the Python interpreter to point to the VirtualEnv interpreter. Have I set it up incorrectly?
Python Interpreter:
When I run I get this message:
/projects/DE/.env/bin/python -m training Could not import runpy module Traceback (most recent call last): File "/Users/deepak/anaconda/lib/python3.6/runpy.py", line 14, in <module> import importlib.machinery # importlib first so we can test #15386 via -m File "/projects/DE/.env/lib/python3.6/importlib/__init__.py", line 57, in <module> import types File "/projects/DE/training/types.py", line 2, in <module> import json File "/Users/deepak/anaconda/lib/python3.6/json/__init__.py", line 106, in <module> from .decoder import JSONDecoder, JSONDecodeError File "/Users/deepak/anaconda/lib/python3.6/json/decoder.py", line 3, in <module> import re File "/projects/DE/.env/lib/python3.6/re.py", line 122, in <module> import enum File "/projects/DE/.env/lib/python3.6/enum.py", line 2, in <module> from types import MappingProxyType, DynamicClassAttribute ImportError: cannot import name 'MappingProxyType'``` I am not sure why PyCharm is using the Anaconda python. I am not sure if there are any other places where the interpreter needs to be changed to point to the virtualenv.
The same command (/projects/DE/.env/bin/python -m training) seems to work when I run from the terminal.
What change can I make so that I can run the module from PyCharm?


[file name].py, click on that. It will pop open a window whose title isRun/Debug Configurations. In the Configuration tab, it should have a section calledPython Interpreter. Is it using Anaconda, Python, or your virtual environment?/projects/DE/.env/bin/python -m training). This is the same as the first line of the stackstrace I posted above. I am on Mac High Sierra.