在python中导入密钥环库时出错

时间:2017-04-19 15:18:15

标签: python python-3.x pythonanywhere

导入密钥环库时,我一直收到同样的错误。只需添加'导入密钥环'代码导致出现此错误。我已经尝试过再次安装库,但这并没有解决它。

我在pythonanywhere中使用python 3.5。

有人可以帮我弄清楚可能会发生什么,或者我可以尝试做些什么来修复它?

这是错误消息。

Traceback (most recent call last): 
File "/home/Marketscale/Tests/OAuth Test.py", line 3, in <module> import keyring 
File "<frozen importlib._bootstrap>", line 969, in _find_and_load 
File "<frozen importlib._bootstrap>", line 958, in _find_and_load_unlocked 
File "<frozen importlib._bootstrap>", line 664, in _load_unlocked 
File "<frozen importlib._bootstrap>", line 634, in _load_backward_compatible 
File "/home/Marketscale/.local/lib/python3.5/site-packages/keyring-10.3.2-py3.5.egg/keyring/__init__.py", line 6, in <module> 
File "<frozen importlib._bootstrap>", line 969, in _find_and_load 
File "<frozen importlib._bootstrap>", line 958, in _find_and_load_unlocked 
File "<frozen importlib._bootstrap>", line 664, in _load_unlocked 
File "<frozen importlib._bootstrap>", line 634, in _load_backward_compatible 
File "/home/Marketscale/.local/lib/python3.5/site-packages/keyring-10.3.2-py3.5.egg/keyring/core.py", line 149, in <module> 
File "/home/Marketscale/.local/lib/python3.5/site-packages/keyring-10.3.2-py3.5.egg/keyring/core.py", line 65, in init_backend 
File "/home/Marketscale/.local/lib/python3.5/site-packages/keyring-10.3.2-py3.5.egg/keyring/util/__init__.py", line 20, in wrapper 
File "/home/Marketscale/.local/lib/python3.5/site-packages/keyring-10.3.2-py3.5.egg/keyring/backend.py", line 179, in get_all_keyring 
File "/home/Marketscale/.local/lib/python3.5/site-packages/keyring-10.3.2-py3.5.egg/keyring/backend.py", line 139, in _load_backends 
File "/home/Marketscale/.local/lib/python3.5/site-packages/keyring-10.3.2-py3.5.egg/keyring/backend.py", line 131, in _load_backend 
File "/usr/lib/python3.5/importlib/__init__.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) 
File "<frozen importlib._bootstrap>", line 986, in _gcd_import 
File "<frozen importlib._bootstrap>", line 969, in _find_and_load 
File "<frozen importlib._bootstrap>", line 958, in _find_and_load_unlocked 
File "<frozen importlib._bootstrap>", line 664, in _load_unlocked 
File "<frozen importlib._bootstrap>", line 634, in _load_backward_compatible 
File "/home/Marketscale/.local/lib/python3.5/site-packages/keyring-10.3.2-py3.5.egg/keyring/backends/SecretService.py", line 9, in <module> 
File "<frozen importlib._bootstrap>", line 969, in _find_and_load 
File "<frozen importlib._bootstrap>", line 958, in _find_and_load_unlocked 
File "<frozen importlib._bootstrap>", line 664, in _load_unlocked 
File "<frozen importlib._bootstrap>", line 634, in _load_backward_compatible 
File "/home/Marketscale/.local/lib/python3.5/site-packages/SecretStorage-2.3.1-py3.5.egg/secretstorage/__init__.py", line 13, in <module> 
File "/usr/lib/python3/dist-packages/dbus/__init__.py", line 81, in <module> import dbus.exceptions as exceptions 
AttributeError: module 'dbus' has no attribute 'exceptions'
>>>

提前感谢您提供的任何帮助。

1 个答案:

答案 0 :(得分:2)

我的猜测是,其中一个系统安装的模块与您用pip install --user安装到〜/ .local

的模块之间存在某种冲突

我建议切换到virtualenv以获得一组“干净”的模块/依赖项。更多信息:https://help.pythonanywhere.com/pages/Virtualenvs