我正在尝试设置一个本地目录,其中包含可以在没有互联网连接的计算机上重复使用的安装包,但我在使用某些包时遇到了问题。
我首先下载软件包
pip download -r requirements.txt -d my_packages --no-binary :all:
然后我尝试安装它们
pip install -r requirements.txt --no-index -f my_packages
我安装时遇到问题的软件包之一是elasticsearch-dsl==6.1.0
:
pip install -r requirements --no-index -f my_packages
Looking in links: my_packages
Collecting elasticsearch-dsl==6.1.0
Collecting six (from elasticsearch-dsl==6.1.0)
Collecting python-dateutil (from elasticsearch-dsl==6.1.0)
Installing build dependencies ... error
Complete output from command /Users/Oskar/.pyenv/versions/2.7.15/envs/no_internet/bin/python2.7 -m pip install --ignore-installed --no-user --prefix /private/var/folders/36/t0_t6_td2f560t2j0149vjmw0000gn/T/pip-build-env-moib0N --no-warn-script-location --no-binary :none: --only-binary :none: --no-index --find-links my_packages -- setuptools wheel:
Looking in links: my_packages
Collecting setuptools
Could not find a version that satisfies the requirement setuptools (from versions: )
No matching distribution found for setuptools
Sure, setuptools
我可以手动安装,但软件包数量多于所有其他软件包所需的软件包数量。django-guardian==1.4.9
另一个例子需要pytest-runner
由于某种原因没有下载pip download
Use pip wheel
, 代替pip download
, 预下载并编译你的依赖。
$ pip install wheel
$ pip wheel -w my_wheels python-dateutil --no-binary :all:
$ pip install -f my_wheels --no-index python-dateutil # works
$ pip install -f my_packages --no-index python-dateutil # breaks
pip wheel
建立python-dateutil
包,所以你不需要setuptools_scm
稍后期间pip install
.
根据文档,
Wheel 是一种内置封装格式,具有以下优点:
在每次安装期间重新编译您的软件。
因此,我推测pip wheel
将使用构建时依赖项,例如setuptools_scm
, but pip install
不会,因为.whl
已建成。
The --no-binary :all:
选项仍然做正确的事情:下载源代码.tar.gz
而不是任何二进制发行版。
(jwodder 很精明地指出了运行时依赖项之间的差异i.e. install_requires
和构建时依赖i.e. setup_requires
.)
我在本地环境测试过,没有setuptools_scm
and no pytest-runner
, 没问题。
(py3) j@computer:~/so-examples|⇒ pip freeze
django-guardian==1.4.9
python-dateutil==2.7.3
six==1.11.0
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)