ImportError: No module named pkg_resources 解决办法

在执行ceph-deploy 出现如下的错误:# ceph-deploy new
Traceback (most recent call last):
  File "/usr/bin/ceph-deploy", line 18, in <module>
    from ceph_deploy.cli import main
  File "/usr/lib/python2.7/site-packages/ceph_deploy/cli.py", line 1, in <module>
    import pkg_resources
ImportError: No module named pkg_resources
原因:这个问题通常是由于升级到python2.7后执行pip产生的,解决方案是重新在python2.7环境中安装pip
解决办法# wget https://pypi.python.org/packages/source/d/distribute/distribute-0.7.3.zip --no-check-certificate

# unzip distribute-0.7.3.zip
Archive:  distribute-0.7.3.zip
  inflating: distribute-0.7.3/MANIFEST.in 
  inflating: distribute-0.7.3/PKG-INFO 
  inflating: distribute-0.7.3/pkg_resources.py 
  inflating: distribute-0.7.3/setup.cfg 
  inflating: distribute-0.7.3/setup.py 
  inflating: distribute-0.7.3/distribute.egg-info/dependency_links.txt 
  inflating: distribute-0.7.3/distribute.egg-info/PKG-INFO 
  inflating: distribute-0.7.3/distribute.egg-info/requires.txt 
  inflating: distribute-0.7.3/distribute.egg-info/SOURCES.txt 
  inflating: distribute-0.7.3/distribute.egg-info/top_level.txt 
  inflating: distribute-0.7.3/distribute.egg-info/zip-safe 
  inflating: distribute-0.7.3/setuptools/archive_util.py 
  inflating: distribute-0.7.3/setuptools/compat.py 
  inflating: distribute-0.7.3/setuptools/depends.py 
  inflating: distribute-0.7.3/setuptools/dist.py 
  inflating: distribute-0.7.3/setuptools/extension.py 
  inflating: distribute-0.7.3/setuptools/package_index.py 
  inflating: distribute-0.7.3/setuptools/py24compat.py 
  inflating: distribute-0.7.3/setuptools/py27compat.py 
  inflating: distribute-0.7.3/setuptools/sandbox.py 
  inflating: distribute-0.7.3/setuptools/script template (dev).py 
  inflating: distribute-0.7.3/setuptools/script template.py 
  inflating: distribute-0.7.3/setuptools/site-patch.py 
  inflating: distribute-0.7.3/setuptools/ssl_support.py 
  inflating: distribute-0.7.3/setuptools/__init__.py 
  inflating: distribute-0.7.3/setuptools/command/alias.py 
  inflating: distribute-0.7.3/setuptools/command/bdist_egg.py 
  inflating: distribute-0.7.3/setuptools/command/bdist_rpm.py 
  inflating: distribute-0.7.3/setuptools/command/bdist_wininst.py 
  inflating: distribute-0.7.3/setuptools/command/build_ext.py 
  inflating: distribute-0.7.3/setuptools/command/build_py.py 
  inflating: distribute-0.7.3/setuptools/command/develop.py 
  inflating: distribute-0.7.3/setuptools/command/easy_install.py 
  inflating: distribute-0.7.3/setuptools/command/egg_info.py 
  inflating: distribute-0.7.3/setuptools/command/install.py 
  inflating: distribute-0.7.3/setuptools/command/install_egg_info.py 
  inflating: distribute-0.7.3/setuptools/command/install_lib.py 
  inflating: distribute-0.7.3/setuptools/command/install_scripts.py 
  inflating: distribute-0.7.3/setuptools/command/launcher manifest.xml 
  inflating: distribute-0.7.3/setuptools/command/register.py 
  inflating: distribute-0.7.3/setuptools/command/rotate.py 
  inflating: distribute-0.7.3/setuptools/command/saveopts.py 
  inflating: distribute-0.7.3/setuptools/command/sdist.py 
  inflating: distribute-0.7.3/setuptools/command/setopt.py 
  inflating: distribute-0.7.3/setuptools/command/test.py 
  inflating: distribute-0.7.3/setuptools/command/upload.py 
  inflating: distribute-0.7.3/setuptools/command/upload_docs.py 
  inflating: distribute-0.7.3/setuptools/command/__init__.py 
  inflating: distribute-0.7.3/setuptools.egg-info/dependency_links.txt 
  inflating: distribute-0.7.3/setuptools.egg-info/entry_points.txt 
  inflating: distribute-0.7.3/setuptools.egg-info/entry_points.txt.orig 
  inflating: distribute-0.7.3/setuptools.egg-info/PKG-INFO 
  inflating: distribute-0.7.3/setuptools.egg-info/requires.txt 
  inflating: distribute-0.7.3/setuptools.egg-info/requires.txt.orig 
  inflating: distribute-0.7.3/setuptools.egg-info/SOURCES.txt 
  inflating: distribute-0.7.3/setuptools.egg-info/top_level.txt 
  inflating: distribute-0.7.3/setuptools.egg-info/zip-safe 
# ls
distribute-0.7.3  distribute-0.7.3.zip
# cd distribute-0.7.3
# python setup.py install
running install
running bdist_egg
running egg_info
writing requirements to distribute.egg-info/requires.txt
writing distribute.egg-info/PKG-INFO
writing top-level names to distribute.egg-info/top_level.txt
writing dependency_links to distribute.egg-info/dependency_links.txt
reading manifest file 'distribute.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file 'distribute.egg-info/SOURCES.txt'
installing library code to build/bdist.linux-x86_64/egg
running install_lib
warning: install_lib: 'build/lib' does not exist -- no Python modules to install

creating build
creating build/bdist.linux-x86_64
creating build/bdist.linux-x86_64/egg
creating build/bdist.linux-x86_64/egg/EGG-INFO
copying distribute.egg-info/PKG-INFO -> build/bdist.linux-x86_64/egg/EGG-INFO
copying distribute.egg-info/SOURCES.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying distribute.egg-info/dependency_links.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying distribute.egg-info/requires.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying distribute.egg-info/top_level.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying distribute.egg-info/zip-safe -> build/bdist.linux-x86_64/egg/EGG-INFO
creating dist
creating 'dist/distribute-0.7.3-py2.7.egg' and adding 'build/bdist.linux-x86_64/egg' to it
removing 'build/bdist.linux-x86_64/egg' (and everything under it)
Processing distribute-0.7.3-py2.7.egg
Copying distribute-0.7.3-py2.7.egg to /usr/lib/python2.7/site-packages
Adding distribute 0.7.3 to easy-install.pth file

Installed /usr/lib/python2.7/site-packages/distribute-0.7.3-py2.7.egg
Processing dependencies for distribute==0.7.3
Searching for setuptools==0.8b2
Best match: setuptools 0.8b2
Adding setuptools 0.8b2 to easy-install.pth file
Installing easy_install script to /usr/bin
Installing easy_install-2.7 script to /usr/bin

Using /root/software/distribute-0.7.3
Finished processing dependencies for distribute==0.7.3
]# ceph-deploy
usage: ceph-deploy [-h] [-v | -q] [--version] [--username USERNAME]
                   [--overwrite-conf] [--ceph-conf CEPH_CONF]
                   COMMAND ...

Easy Ceph deployment

    -^-
   /   \
   |O o|  ceph-deploy v2.0.1
   ).-.(
  '/|||\`
  | '|` |
    '|`

Full documentation can be found at: http://ceph.com/ceph-deploy/docs

optional arguments:
  -h, --help            show this help message and exit
  -v, --verbose         be more verbose
  -q, --quiet           be less verbose
  --version             the current installed version of ceph-deploy
  --username USERNAME   the username to connect to the remote host
  --overwrite-conf      overwrite an existing conf file on remote host (if
                        present)
  --ceph-conf CEPH_CONF
                        use (or reuse) a given ceph.conf file

commands:
  COMMAND               description
    new                 Start deploying a new cluster, and write a
                        CLUSTER.conf and keyring for it.
    install             Install Ceph packages on remote hosts.
    rgw                 Ceph RGW daemon management
    mgr                 Ceph MGR daemon management
    mds                 Ceph MDS daemon management
    mon                 Ceph MON Daemon management
    gatherkeys          Gather authentication keys for provisioning new nodes.
    disk                Manage disks on a remote host.
    osd                 Prepare a data disk on remote host.
    repo                Repo definition management
    admin               Push configuration and client.admin key to a remote
                        host.
    config              Copy ceph.conf to/from remote host(s)
    uninstall           Remove Ceph packages from remote hosts.
    purgedata           Purge (delete, destroy, discard, shred) any Ceph data
                        from /var/lib/ceph
    purge               Remove Ceph packages from remote hosts and purge all
                        data.
    forgetkeys          Remove authentication keys from the local directory.
    pkg                 Manage packages on remote hosts.
    calamari            Install and configure Calamari nodes. Assumes that a
                        repository with Calamari packages is already
                        configured. Refer to the docs for examples
                        (http://ceph.com/ceph-deploy/docs/conf.html)

See 'ceph-deploy <command> --help' for help on a specific command
#
  • 4
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值