使pip下载更喜欢下载源代码发行版(而不是转盘)
This question explains how to make pip download and save packages. If I follow this formula, Pip will download wheel (.whl) files if available.
(venv) [user@host glances]$ pip download -d wheelhouse -r build_requirements.txt
Collecting wheel (from -r build_requirements.txt (line 1))
File was already downloaded /usr_data/tmp/glances/wheelhouse/wheel-0.29.0-py2.py3-none-any.whl
Collecting pex (from -r build_requirements.txt (line 2))
File was already downloaded /usr_data/tmp/glances/wheelhouse/pex-1.1.18-py2.py3-none-any.whl
Collecting requests (from -r build_requirements.txt (line 3))
File was already downloaded /usr_data/tmp/glances/wheelhouse/requests-2.12.4-py2.py3-none-any.whl
Collecting pip (from -r build_requirements.txt (line 4))
File was already downloaded /usr_data/tmp/glances/wheelhouse/pip-9.0.1-py2.py3-none-any.whl
Collecting setuptools (from -r build_requirements.txt (line 5))
File was already downloaded /usr_data/tmp/glances/wheelhouse/setuptools-32.3.1-py2.py3-none-any.whl
Successfully downloaded wheel pex requests pip setuptools
它下载的每个文件都是一个Wheel-但是,如果我想获取其他类型的文件怎么办?
Every single file that it downloaded was a Wheel - but what if I want to get a different kind of file?
我实际上是要优先于.whl文件下载sdist(.tar.gz)文件?有没有办法告诉Pip我实际上希望获得哪种文件?因此,我可能不需要一堆tar.gz文件,而不是满满的目录.
I actually want to download the sdist (.tar.gz) files in preference to .whl files? Is there a way to tell Pip what kinds of files I actually want it to get? So instead of getting a directory full of wheels I might want a bunch of tar.gz files.
根据pip install -h
:
-不使用转盘在搜索索引和查找链接位置时,不要查找并喜欢转盘档案.不推荐使用--no-binary.
--no-use-wheel Do not Find and prefer wheel archives when searching indexes and find-links locations. DEPRECATED in favour of --no-binary.
还有
-no-binary不使用二进制包.可以多次提供,每次都增加到现有值.接受:all:禁用所有二进制软件包,:none:清空集合或一个或多个软件包
--no-binary Do not use binary packages. Can be supplied multiple times, and each time adds to the existing value. Accepts either :all: to disable all binary packages, :none: to empty the set, or one or more package
如果您的版本太旧,则可能需要使用pip install -U pip
升级pip.
You may need to upgrade pip with pip install -U pip
if your version is too old.