Script running in PyCharm but not from the command line

There are a few possible things that can be causing this: The same python interpreter? Check with import sys; print(sys.executable) Is it the same working directory? Check with import os; print(os.getcwd()) Discrepancies in sys.path, which is the list python searches sequentially for import locations, can possibly caused by environment variables. Check with import sys; print(sys.path).