How to run Python egg files directly without installing them?

前端 未结 4 2082

Is it possible to run Python egg files directly as you can run jar files with Java?

For example, with Java you might dos something like:



        
4条回答
  •  情话喂你
    2021-01-31 03:35

    As of Python 2.6, you can use python some.egg and it will be executed if it includes a module named __main__.

    For earlier versions of Python, you can use PYTHONPATH=some.egg python -m some module, and somemodule from the egg will be run as the main module. (Note: if you're on Windows, you'd need to do a separate SET PYTHONPATH=some.egg.)

提交回复
热议问题