您当前的位置:首页 > 计算机 > 编程开发 > Python

bandersnatch报错No module Named的解决办法

时间:05-11来源:作者:点击数:

ERROR: Unable to load entry point swift_plugin = bandersnatch_storage_plugins.swift:SwiftStorage: No module named ‘keystoneauth1’

这个办法时在安装时,因python版本原因缺少了,解决办法:

pip3 install keystoneauth1

Collecting keystoneauth1

Downloading https://files.pythonhosted.org/packages/7c/2e/dcfd2412941244e8a00a568654ce1687a1cab7be05d634ada0b5a078d0a3/keystoneauth1-4.4.0-py3-none-any.whl (314kB)

100% |████████████████████████████████| 317kB 240kB/s

Collecting pbr!=2.1.0,>=2.0.0 (from keystoneauth1)

Downloading https://files.pythonhosted.org/packages/73/c3/d45171501210b0305f4c93fafe50950f0c2228e87034ceb51744bd03ff08/pbr-5.8.0-py2.py3-none-any.whl (112kB)

100% |████████████████████████████████| 122kB 184kB/s

Requirement already satisfied: requests>=2.14.2 in /usr/lib/python3/dist-packages (from keystoneauth1)

Collecting stevedore>=1.20.0 (from keystoneauth1)

Downloading https://files.pythonhosted.org/packages/7a/bc/fcce9e50da73ea23af6d236e05e15db8a02da1099a5e0a479451bcea3833/stevedore-3.5.0-py3-none-any.whl (49kB)

100% |████████████████████████████████| 51kB 166kB/s

Requirement already satisfied: six>=1.10.0 in /usr/lib/python3/dist-packages (from keystoneauth1)

Collecting iso8601>=0.1.11 (from keystoneauth1)

Downloading https://files.pythonhosted.org/packages/df/e5/589bc81d410139ec4e4f37d9af5a50987566abf6d087b3c4fbed708109a9/iso8601-1.0.2-py3-none-any.whl

Collecting os-service-types>=1.2.0 (from keystoneauth1)

Downloading https://files.pythonhosted.org/packages/10/2d/318b2b631f68e0fc221ba8f45d163bf810cdb795cf242fe85ad3e5d45639/os_service_types-1.7.0-py2.py3-none-any.whl

Collecting importlib-metadata>=1.7.0; python_version < “3.8” (from stevedore>=1.20.0->keystoneauth1)

Downloading https://files.pythonhosted.org/packages/c4/1f/e2238896149df09953efcc53bdcc7d23597d6c53e428c30e572eda5ec6eb/importlib_metadata-4.8.2-py3-none-any.whl

Collecting zipp>=0.5 (from importlib-metadata>=1.7.0; python_version < “3.8”->stevedore>=1.20.0->keystoneauth1)

Using cached https://files.pythonhosted.org/packages/bd/df/d4a4974a3e3957fd1c1fa3082366d7fff6e428ddb55f074bf64876f8e8ad/zipp-3.6.0-py3-none-any.whl

Requirement already satisfied: typing-extensions>=3.6.4; python_version < “3.8” in /usr/local/lib/python3.7/dist-packages (from importlib-metadata>=1.7.0; python_version < “3.8”->stevedore>=1.20.0->keystoneauth1)

Installing collected packages: pbr, zipp, importlib-metadata, stevedore, iso8601, os-service-types, keystoneauth1

Successfully installed importlib-metadata-4.8.2 iso8601-1.0.2 keystoneauth1-4.4.0 os-service-types-1.7.0 pbr-5.8.0 stevedore-3.5.0 zipp-3.6.0


ERROR: Unable to load entry point swift_plugin = bandersnatch_storage_plugins.swift:SwiftStorage: No module named ‘swiftclient’

这个时安装时,缺少了python-swiftclient。

解决办法:

pip3 install python-swiftclient

Collecting python-swiftclient

Downloading https://files.pythonhosted.org/packages/f6/5f/6784a830e618a89272f8efee784930e614be285a6d3e82986916076fe69e/python_swiftclient-3.13.0-py2.py3-none-any.whl (86kB)

100% |████████████████████████████████| 92kB 281kB/s

Requirement already satisfied: six>=1.9.0 in /usr/lib/python3/dist-packages (from python-swiftclient)

Requirement already satisfied: requests>=1.1.0 in /usr/lib/python3/dist-packages (from python-swiftclient)

Installing collected packages: python-swiftclient

Successfully installed python-swiftclient-3.13.0


ModuleNotFoundError: No module named ‘apt_pkg’

这个报错通常是安装新版本的python后出现,完整报错信息如下:

mirror@mirror:~$ sudo apt-get update

Hit:1 http://archive.ubuntu.com/ubuntu bionic InRelease

Hit:2 http://ppa.launchpad.net/deadsnakes/ppa/ubuntu bionic InRelease

Hit:3 http://archive.ubuntu.com/ubuntu bionic-updates InRelease

Hit:4 http://archive.ubuntu.com/ubuntu bionic-backports InRelease

Hit:5 http://archive.ubuntu.com/ubuntu bionic-security InRelease

Traceback (most recent call last):

File “/usr/lib/cnf-update-db”, line 8, in

from CommandNotFound.db.creator import DbCreator

File “/usr/lib/python3/dist-packages/CommandNotFound/db/creator.py”, line 11, in

import apt_pkg

ModuleNotFoundError: No module named ‘apt_pkg’

Reading package lists… Done

E: Problem executing scripts APT::Update::Post-Invoke-Success ‘if /usr/bin/test -w /var/lib/command-not-found/ -a -e /usr/lib/cnf-update-db; then /usr/lib/cnf-update-db > /dev/null; fi’

E: Sub-process returned an error code

依照网上的一些方法尝试解决,依照没有成功,因为我的ubuntu原本是python3.6,安装了python3.7版本,最后的绝招是:

 update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.7 1
update-alternatives --config python3
apt-get remove --purge python3.6
apt-get install python3.7

最后再执行apt-get update,没有再报错。

mirror@mirror:~$ apt-get update

Reading package lists… Done

E: Could not open lock file /var/lib/apt/lists/lock - open (13: Permission denied)

E: Unable to lock directory /var/lib/apt/lists/

W: Problem unlinking the file /var/cache/apt/pkgcache.bin - RemoveCaches (13: Permission denied)

W: Problem unlinking the file /var/cache/apt/srcpkgcache.bin - RemoveCaches (13: Permission denied)

mirror@mirror:~$ sudo apt-get update

[sudo] password for mirror:

Hit:1 http://archive.ubuntu.com/ubuntu bionic InRelease

Hit:2 http://ppa.launchpad.net/deadsnakes/ppa/ubuntu bionic InRelease

Hit:3 http://archive.ubuntu.com/ubuntu bionic-updates InRelease

Hit:4 http://archive.ubuntu.com/ubuntu bionic-backports InRelease

Hit:5 http://archive.ubuntu.com/ubuntu bionic-security InRelease

Reading package lists… Done

以上方法仅供参考,还是要找到适合自己环境的解决方法。

方便获取更多学习、工作、生活信息请关注本站微信公众号城东书院 微信服务号城东书院 微信订阅号
推荐内容
相关内容
栏目更新
栏目热门