ModuleNotFoundError: No module named ‘…’ - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: General Coding Help (https://python-forum.io/forum-8.html) +--- Thread: ModuleNotFoundError: No module named ‘…’ (/thread-31441.html) |
ModuleNotFoundError: No module named ‘…’ - Frank911 - Dec-11-2020 Running outside Pycharm I always get an error. I want to be able to run the module in:
I looked at paths, pythonpaths, packages, modules, imports relative/absolute. It is driving me crazy and I just don’t get it. Inside Pycharm IDE it runs as expected. C:\Data\Experiment>C:\Data\Experiment\module\ConsumerModule\consumer.py Traceback (most recent call last): File "C:\Data\Experiment\module\ConsumerModule\consumer.py", line 1, in <module> from HelperModules.use_me import returnfunction ModuleNotFoundError: No module named 'HelperModules' The code is a simple. Don't say put the "use_me" module in the ConsumerModule folder. I get that. I want to structure hundreds of modules in separate folders for structuring a huge project. Project --ConsumerModule ----Consumer.py ------from HelperModules.use_me import returnfunction ------def test(): ------str = returnfunction() ------print (str) ------if __name__ == '__main__': ------test() --HelperModules ----use_me ------__init__.py --------def returnfunction(): --------return 'from returnfunction' RE: ModuleNotFoundError: No module named ‘…’ - michael1789 - Dec-11-2020 Not, sure, but like other IDEs it might run a bundled version of python installed with it and not the python version you installed separately. Take a quick look through the options in pycharm and see if you can switch it. The other route would be to use pip in the system command prompt to install the libraries you want into the version too. |