问题
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:
Create a new
__main__.py
in your project root directory and start your program from there (by importing the oldmain.py
etc.)Make sure the program runs as expected: Run
python __main__.py [arguments]
in the root directory.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