Run PyCharm project outside of PyCharm

白昼怎懂夜的黑 提交于 2021-01-28 03:09:29

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!