Dec-12-2019, 04:03 PM
I have a directory structure as below.
Pro_test_main/Pro_test
I would like to run Pro_test as a module. In my Pro_test folder I have two things, one is __main__.py file and another is a package named pk. I would like to import the package pk in __main__.py
When I run the code using terminal it works ok, I run it from folder Pro_test_main as below
Pro_test_main > python -m Pro_test
But when I run it using PyCharm I am getting an error
Traceback (most recent call last):
File "\anaconda3\lib\runpy.py", line 193, in _run_module_as_main "__main__", mod_spec)
File "\anaconda3\lib\runpy.py", line 85, in _run_code exec(code, run_globals)
File "\Pro_test_main\Pro_test\__main__.py", line 1, in <module>
import pk
ModuleNotFoundError: No module named 'pk'
Pro_test_main/Pro_test
I would like to run Pro_test as a module. In my Pro_test folder I have two things, one is __main__.py file and another is a package named pk. I would like to import the package pk in __main__.py
When I run the code using terminal it works ok, I run it from folder Pro_test_main as below
Pro_test_main > python -m Pro_test
But when I run it using PyCharm I am getting an error
Traceback (most recent call last):
File "\anaconda3\lib\runpy.py", line 193, in _run_module_as_main "__main__", mod_spec)
File "\anaconda3\lib\runpy.py", line 85, in _run_code exec(code, run_globals)
File "\Pro_test_main\Pro_test\__main__.py", line 1, in <module>
import pk
ModuleNotFoundError: No module named 'pk'