[Linux] 安裝 pylint 時出現 No module named pbr.pbr_json 錯誤

[Linux] 安裝 pylint 時出現 No module named pbr.pbr_json 錯誤

今天在 CentOS 7 上安裝 pylint 時,莫名地遇到了沒碰過的問題,

說 ImportError: No module named pbr.pbr_json:

Running six-1.11.0/setup.py -q bdist_egg --dist-dir /tmp/easy_install-B6zjOb/unittest2-1.1.0/temp/easy_install-1myJ6o/six-1.11.0/egg-dist-tmp-GKqio6
Traceback (most recent call last):
  File "setup.py", line 181, in 
    install()
  File "setup.py", line 177, in install
    **kwargs
  File "/usr/lib64/python2.6/distutils/core.py", line 152, in setup
    dist.run_commands()
  File "/usr/lib64/python2.6/distutils/dist.py", line 975, in run_commands
    self.run_command(cmd)
  File "/usr/lib64/python2.6/distutils/dist.py", line 995, in run_command
    cmd_obj.run()
  File "/usr/lib/python2.6/site-packages/setuptools/command/install.py", line 73, in run
    self.do_egg_install()
  File "/usr/lib/python2.6/site-packages/setuptools/command/install.py", line 101, in do_egg_install
    cmd.run()
  File "/usr/lib/python2.6/site-packages/setuptools/command/easy_install.py", line 236, in run
    self.easy_install(spec, not self.no_deps)
  File "/usr/lib/python2.6/site-packages/setuptools/command/easy_install.py", line 452, in easy_install
    return self.install_item(None, spec, tmpdir, deps, True)
  File "/usr/lib/python2.6/site-packages/setuptools/command/easy_install.py", line 504, in install_item
    self.process_distribution(spec, dist, deps)
  File "/usr/lib/python2.6/site-packages/setuptools/command/easy_install.py", line 545, in process_distribution
    [requirement], self.local_index, self.easy_install
  File "/usr/lib/python2.6/site-packages/pkg_resources.py", line 538, in resolve
    dist = best[req.key] = env.best_match(req, self, installer)
  File "/usr/lib/python2.6/site-packages/pkg_resources.py", line 780, in best_match
    return self.obtain(req, installer) # try and download/install
  File "/usr/lib/python2.6/site-packages/pkg_resources.py", line 792, in obtain
    return installer(requirement)
  File "/usr/lib/python2.6/site-packages/setuptools/command/easy_install.py", line 472, in easy_install
    return self.install_item(spec, dist.location, tmpdir, deps)
  File "/usr/lib/python2.6/site-packages/setuptools/command/easy_install.py", line 502, in install_item
    dists = self.install_eggs(spec, download, tmpdir)
  File "/usr/lib/python2.6/site-packages/setuptools/command/easy_install.py", line 681, in install_eggs
    return self.build_and_install(setup_script, setup_base)
  File "/usr/lib/python2.6/site-packages/setuptools/command/easy_install.py", line 958, in build_and_install
    self.run_setup(setup_script, setup_base, args)
  File "/usr/lib/python2.6/site-packages/setuptools/command/easy_install.py", line 947, in run_setup
    run_setup(setup_script, args)
  File "/usr/lib/python2.6/site-packages/setuptools/sandbox.py", line 29, in run_setup
    lambda: execfile(
  File "/usr/lib/python2.6/site-packages/setuptools/sandbox.py", line 70, in run
    return func()
  File "/usr/lib/python2.6/site-packages/setuptools/sandbox.py", line 31, in 
    {'__file__':setup_script, '__name__':'__main__'}
  File "setup.py", line 87, in 
    result = []
  File "/usr/lib64/python2.6/distutils/core.py", line 113, in setup
    _setup_distribution = dist = klass(attrs)
  File "/usr/lib/python2.6/site-packages/setuptools/dist.py", line 221, in __init__
    self.fetch_build_eggs(attrs.pop('setup_requires'))
  File "/usr/lib/python2.6/site-packages/setuptools/dist.py", line 245, in fetch_build_eggs
    parse_requirements(requires), installer=self.fetch_build_egg
  File "/usr/lib/python2.6/site-packages/pkg_resources.py", line 538, in resolve
    dist = best[req.key] = env.best_match(req, self, installer)
  File "/usr/lib/python2.6/site-packages/pkg_resources.py", line 780, in best_match
    return self.obtain(req, installer) # try and download/install
  File "/usr/lib/python2.6/site-packages/pkg_resources.py", line 792, in obtain
    return installer(requirement)
  File "/usr/lib/python2.6/site-packages/setuptools/dist.py", line 293, in fetch_build_egg
    return cmd.easy_install(req)
  File "/usr/lib/python2.6/site-packages/setuptools/command/easy_install.py", line 472, in easy_install
    return self.install_item(spec, dist.location, tmpdir, deps)
  File "/usr/lib/python2.6/site-packages/setuptools/command/easy_install.py", line 502, in install_item
    dists = self.install_eggs(spec, download, tmpdir)
  File "/usr/lib/python2.6/site-packages/setuptools/command/easy_install.py", line 681, in install_eggs
    return self.build_and_install(setup_script, setup_base)
  File "/usr/lib/python2.6/site-packages/setuptools/command/easy_install.py", line 958, in build_and_install
    self.run_setup(setup_script, setup_base, args)
  File "/usr/lib/python2.6/site-packages/setuptools/command/easy_install.py", line 947, in run_setup
    run_setup(setup_script, args)
  File "/usr/lib/python2.6/site-packages/setuptools/sandbox.py", line 29, in run_setup
    lambda: execfile(
  File "/usr/lib/python2.6/site-packages/setuptools/sandbox.py", line 70, in run
    return func()
  File "/usr/lib/python2.6/site-packages/setuptools/sandbox.py", line 31, in 
    {'__file__':setup_script, '__name__':'__main__'}
  File "setup.py", line 55, in 
    distname = getattr(__pkginfo__, 'distname', modname)
  File "/usr/lib64/python2.6/distutils/core.py", line 152, in setup
    dist.run_commands()
  File "/usr/lib64/python2.6/distutils/dist.py", line 975, in run_commands
    self.run_command(cmd)
  File "/usr/lib64/python2.6/distutils/dist.py", line 995, in run_command
    cmd_obj.run()
  File "/usr/lib/python2.6/site-packages/setuptools/command/bdist_egg.py", line 167, in run
    self.run_command("egg_info")
  File "/usr/lib64/python2.6/distutils/cmd.py", line 333, in run_command
    self.distribution.run_command(command)
  File "/usr/lib64/python2.6/distutils/dist.py", line 995, in run_command
    cmd_obj.run()
  File "/usr/lib/python2.6/site-packages/setuptools/command/egg_info.py", line 171, in run
    writer = ep.load(installer=installer)
  File "/usr/lib/python2.6/site-packages/pkg_resources.py", line 1948, in load
    entry = __import__(self.module_name, globals(),globals(), ['__name__'])
ImportError: No module named pbr.pbr_json

 

查了一下,似乎 pbr 套件需要更新 (但不知道為什麼以前不會有問題)…

先安裝 pip:

sudo yum -y install epel-release
sudo yum -y install python-pip

 

再用 pip 更新 pbr 套件:

sudo pip install -U pbr

 

再次安裝 pylint 就沒遇到問題了~

 

參考資料:

Cannot install: missing pbr_json

How to install pip on CentOS 6.8

(本頁面已被瀏覽過 770 次)

發佈留言

發佈留言必須填寫的電子郵件地址不會公開。 必填欄位標示為 *

這個網站採用 Akismet 服務減少垃圾留言。進一步了解 Akismet 如何處理網站訪客的留言資料