How to export a Python program from PyCharm

大城市里の小女人 提交于 2019-12-10 12:26:08

问题


I have a Python project created in PyCharm. Now that it's finished I want to make it available without PyCharm (making it an executable is not relevant). It consists of different packages and quite a few files inside each package. How can I export the project so I can run it from one file that will call the rest?


回答1:


If you do not want to publish the project and just use it for yourself:

  1. Create a new __main__.py in your project root directory and start your program from there (by importing the old main.py etc.)

  2. Make sure the program runs as expected: Run python __main__.py [arguments] in the root directory.

  3. If this works, zip the whole project directory using an archiver and use like this:

    python myproject.zip [arguments]



来源:https://stackoverflow.com/questions/37811518/how-to-export-a-python-program-from-pycharm

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