您想制作一个Python的wheel,与eggs相比,它们更加新颖、强大,并且支持Python 2/3。
对于像numpy这样流行的库,您不需要自己制作wheel。它们在其发行版中打包了wheels,因此您只需下载即可。许多Python库都会在其发行版中提供wheel。请参见这里:https://pypi.python.org/pypi/numpy
如果您感兴趣,可以在这里了解如何一般性地制作wheel:https://pip.pypa.io/en/stable/reference/pip_wheel/。
或者,您可以直接在目标工作机器上安装numpy。
编辑:
根据您的评论,我认为有必要提到pipdeptree实用程序。如果您需要手动查看pip依赖项,此实用程序将为您列出它们。以下是一个示例:
$ pipdeptree
3to2==1.1.1
anaconda-navigator==1.2.1
ansible==2.2.1.0
- jinja2 [required: <2.9, installed: 2.8]
- MarkupSafe [required: Any, installed: 0.23]
- paramiko [required: Any, installed: 2.1.1]
- cryptography [required: >=1.1, installed: 1.4]
- cffi [required: >=1.4.1, installed: 1.6.0]
- pycparser [required: Any, installed: 2.14]
- enum34 [required: Any, installed: 1.1.6]
- idna [required: >=2.0, installed: 2.1]
- ipaddress [required: Any, installed: 1.0.16]
- pyasn1 [required: >=0.1.8, installed: 0.1.9]
- setuptools [required: >=11.3, installed: 23.0.0]
- six [required: >=1.4.1, installed: 1.10.0]
- pyasn1 [required: >=0.1.7, installed: 0.1.9]
- pycrypto [required: >=2.6, installed: 2.6.1]
- PyYAML [required: Any, installed: 3.11]
- setuptools [required: Any, installed: 23.0.0
pip install wheel
命令来安装 wheel
。python setup.py bdist_wheel
命令创建一个 .whl 文件。您会在 Python 包的根目录下的 dist
目录中找到该文件。如果您需要同时为 Python 2 和 Python 3 创建单个 .whl 文件,您可能还需要添加 --universal
参数。