我写了一个包并且在依赖中使用了psutil(my-package
依赖于 third-party-package
,而 third-party-package
又依赖于 psutil
)。
由于它应该在没有任何连接和没有 gcc
的服务器上运行,所以我在本地准备了部署,并使用了 psutil
Python 平台 wheel 和 pip install my-package --download
,然后把所有文件发送到服务器。
现在服务器上的一切都准备就绪,但由于某些原因,当我运行安装时,pip
拒绝安装 psutil
。请注意,服务器是 Red Hat 7.2,运行 pip 7.1.0、virtualenv 1.10.1 和 Python 2.7.5(我无法更改任何东西的版本)。
$ pip install /tmp/python_packages/my-package-1.4.zip --no-index
--find-links /tmp/python_packages/ --use-wheel
Ignoring indexes: https://pypi.python.org/simple/
# blablabla, everything goes fine, then
Downloading/unpacking psutil (from third-party-package>=0.9->my-package==1.4)
Could not find any downloads that satisfy the requirement psutil
(from third-party-package>=0.9->my-package==1.4)
Cleaning up...
No distributions at all found for psutil (from third-party-package>=0.9->my-package==1.4)
Storing complete log in /home/anto/.pip/pip.log
以下是 pip.log
的内容:
Downloading/unpacking psutil (from third-party-package>=0.9->my-package==1.4)
URLs to search for versions for psutil (from third-party-package>=0.9->my-package==1.4):
# bla
Skipping file:///tmp/python_packages/psutil-4.2.0-cp27-cp27mu-linux_x86_64.whl
because it is not compatible with this Python
# bla
Could not find any downloads that satisfy the requirement psutil (from third-
party-package>=0.9->my-package==1.4)
Cleaning up...
所以说“与此Python不兼容”,好的。但这里真正奇怪的部分是:如果我先只安装psutil
,然后再安装其他东西,一切都能正常运行。
$ pip install /tmp/python_packages/psutil-4.2.0-cp27-cp27mu-linux_x86_64.whl
Unpacking /tmp/python_packages/psutil-4.2.0-cp27-cp27mu-linux_x86_64.whl
Installing collected packages: psutil
Successfully installed psutil
Cleaning up...
$ pip freeze -l
psutil==4.2.0
$ pip install /tmp/python_packages/my-package-1.4.zip --no-index
--find-links /tmp/python_packages/ --use-wheel
# blablabla
Successfully installed my-package third-party-package
Cleaning up...
我错过了什么?有线索吗?
install_requires = ['psutil']
;没有什么花哨的东西。 - Antopsutil
的wheel是64位的,因为VM是64位的(不过这可能确实与根本原因有关?)。 - Anto