Why does easy_install extract some python eggs and not others?

蹲街弑〆低调 提交于 2019-12-03 05:54:02

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.

I can't explain why some eggs are zipped (the files) and some are directories, but I can offer this: if you hate zipped eggs (like I do) put this in the [easy_install] section of your ~/.pydistutils.cfg:

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