Reputation: 2922
I can run my app from the console that there is in pyCharm but If I try to run my app from a shell my app doesn't find "pymysql" module.
The module is installed in my project in a virtual environment. You can see in the next image how is installed this module.
And If try to run my app from the shell I've got this error:
I'm using python3.
What am I doing wrong? Is there any easy way to access to the module?
Upvotes: 0
Views: 1536
Reputation: 20224
There are several ways:
source venv/bin/activate
.venv/bin/python main.py
venv/bin
to your PATH
, that's almost the same as the first option: export PATH=full/path/to/bin:$PATH
Generally I recommend the first option. But sometimes you may want to use the second one. For example, you want to use this python
in a crontab script.
Upvotes: 2