问题
I have a PyCharm project which uses a virtual env and its own site-packages and I want to be able to run it without needing to open PyCharm everytime.
My current naive solution is runing a batch file which launches the python in the venv and the main script python.exe ../../PythonFiles/Main.pyw
. The issue with this is that the console will stay open as its running from a batch process.
回答1:
You can activate your virtual python environment by this command
source activate yourenvname
then change the directory and go to source directory ../../PythonFiles/ and type
start pythonw Main.pyw
This will help to start the python script in the background & If you don't want to run in the background and keep terminal open remove pyw change it to py extension then run it.
来源:https://stackoverflow.com/questions/56442672/run-pycharm-project-outside-of-pycharm