我正在尝试在没有 Internet 连接的 Centos 7 机器上安装 ruamel.yaml python 库。我试过这个:
使用本地存储库安装 libyaml-devel、python-devel、python-pip
从 pypi 下载 ruamel.yaml-0.13.14.tar 和 ruamel.ordereddict-0.4.6.tar(dependency)。
现在我可以使用 pip install 安装 ruamel.ordereddict 了,但是当我尝试以同样的方式安装 ruamel.yaml 时,出现以下异常:
[root@limulus ruamel.yaml-0.13.14]# pip install . Processing /tmp/python/ruamel.yaml-0.13.14 Complete output from command python setup.py egg_info: Traceback (most recent call last): File "<string>", line 1, in <module> File "/usr/lib/python2.7/site-packages/setuptools/__init__.py", line 2, in <module> from setuptools.extension import Extension, Library File "/usr/lib/python2.7/site-packages/setuptools/extension.py", line 5, in <module> from setuptools.dist import _get_unpatched File "/usr/lib/python2.7/site-packages/setuptools/dist.py", line 7, in <module> from setuptools.command.install import install File "/usr/lib/python2.7/site-packages/setuptools/command/__init__.py", line 8, in <module> from setuptools.command import install_scripts File "/usr/lib/python2.7/site-packages/setuptools/command/install_scripts.py", line 3, in <module> from pkg_resources import Distribution, PathMetadata, ensure_directory File "/usr/lib/python2.7/site-packages/pkg_resources.py", line 74, in <module> import parser File "parser.py", line 77, in <module> from ruamel.yaml.error import MarkedYAMLError # type: ignore File "/usr/lib64/python2.7/site-packages/ruamel/__init__.py", line 5, in <module> __import__('pkg_resources').declare_namespace(__name__) AttributeError: 'module' object has no attribute 'declare_namespace' ---------------------------------------- Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-oOWX1x-build/
在离线模式下安装python库的正确方法是什么?