When I write a simple code in PyCharm:
import setuptools
a = 10 ## This line is of no use
I don't get any error while executing it. But if I try to import setuptools from the terminal I get an error that there is no module named setuptools. What I write at the terminal is:
python3 -c "import setuptools"
I have setuptools installed for python 2.7 and I have tried the same for 2.7 version also and it runs at both the places i.e. terminal and PyCharm.
Looks like the environment setup by pycharm doesn't match the one you have in your terminal.
Try to display
sys.path
in your script executing in pycharm and adjust your PYTHONPATH env var to be inline with it.