I used PyCharm to write a program that mutes me on discord when I say “mute myself”. It works fine when I run it with PyCharm, but when I try to run it with idle or cmd, it won't find the modules I use.
CodePudding user response:
It sounds like you may want to look into something like Poetry to manage the Virtualenv for your program. Poetry will help you bundle together the modules your program needs in a structured way.
After you've packaged your program using poetry, check out the "run" command.
If you don't like Poetry, you can find other alternatives over on the PyPA documentation.
CodePudding user response:
PyCharm, by default, creates a virtual environment where it installs the modules (the venv folder).
I am assuming you are on windows? To use that environment's packages you can activate it in your command line
venv\Scripts\activate.bat
and run your script like
python main.py
Another alternative would be to package your project into a exe using a tool like pyinstaller
# while in your virtual environment
pip install pyinstaller
pyinstaller --onefile main.py