Why does easy_install extract some python eggs and not others?

前端 未结 2 780
时光取名叫无心
时光取名叫无心 2021-02-07 05:48

Looking in my /usr/local/lib/python.../dist-package directory, I have .egg directories and .egg files.

Why does the installer choose to extra

2条回答
  •  故里飘歌
    2021-02-07 06:24

    If the package contains only pure-Python code, it can stay as just an egg file. The Python interpreter can load the Python modules directly from the egg. If the package contains modules written in C or other data, then egg needs to be extracted so the C modules and/or data can be accessed. That's the default behavior of packages, I believe. Newer versions of Python might be able to load C modules from egg files; I'm not sure about that part.

    The creator of the package can also specifically instruct the installer to unzip the package, by passing zip_safe = False to setup() in their setup.py.

    Finally, the person doing the installing can tell easy_install explicitly to unpack eggs by passing it the -Z option or by setting zip_ok = false in the pydistutils.cfg.

提交回复
热议问题