gpt4 book ai didi

python - 属性错误 : module 'importlib._bootstrap' has no attribute 'SourceFileLoader'

转载 作者:太空宇宙 更新时间:2023-11-03 11:38:26 24 4
gpt4 key购买 nike

我是编程新手,所以遇到了这个麻烦。我已经升级了我的 pip,然后使用 pip list、ipython notebook、jupyter notebook 来使用 anaconda,所以在所有这些命令之后我得到了一个答案:

Traceback (most recent call last):
File "/home/bakhytgul/anaconda3/bin/pip", line 7, in <module>
from pip._internal import main
File "/home/bakhytgul/anaconda3/lib/python3.6/site-packages/pip/_internal/__init__.py", line 40, in <module>
from pip._internal.cli.autocompletion import autocomplete
File "/home/bakhytgul/anaconda3/lib/python3.6/site-packages/pip/_internal/cli/autocompletion.py", line 8, in <module>
from pip._internal.cli.main_parser import create_main_parser
File "/home/bakhytgul/anaconda3/lib/python3.6/site-packages/pip/_internal/cli/main_parser.py", line 12, in <module>
from pip._internal.commands import (
File "/home/bakhytgul/anaconda3/lib/python3.6/site-packages/pip/_internal/commands/__init__.py", line 6, in <module>
from pip._internal.commands.completion import CompletionCommand
File "/home/bakhytgul/anaconda3/lib/python3.6/site-packages/pip/_internal/commands/completion.py", line 6, in <module>
from pip._internal.cli.base_command import Command
File "/home/bakhytgul/anaconda3/lib/python3.6/site-packages/pip/_internal/cli/base_command.py", line 19, in <module>
from pip._internal.download import PipSession
File "/home/bakhytgul/anaconda3/lib/python3.6/site-packages/pip/_internal/download.py", line 15, in <module>
from pip._vendor import requests, six, urllib3
File "/home/bakhytgul/anaconda3/lib/python3.6/site-packages/pip/_vendor/requests/__init__.py", line 97, in <module>
from pip._vendor.urllib3.contrib import pyopenssl
File "/home/bakhytgul/anaconda3/lib/python3.6/site-packages/pip/_vendor/urllib3/contrib/pyopenssl.py", line 46, in <module>
import OpenSSL.SSL
File "/home/bakhytgul/anaconda3/lib/python3.6/site-packages/OpenSSL/__init__.py", line 8, in <module>
from OpenSSL import rand, crypto, SSL
File "/home/bakhytgul/anaconda3/lib/python3.6/site-packages/OpenSSL/crypto.py", line 13, in <module>
from cryptography.hazmat.primitives.asymmetric import dsa, rsa
File "/home/bakhytgul/anaconda3/lib/python3.6/site-packages/cryptography/hazmat/primitives/asymmetric/rsa.py", line 14, in <module>
from cryptography.hazmat.backends.interfaces import RSABackend
File "/home/bakhytgul/anaconda3/lib/python3.6/site-packages/cryptography/hazmat/backends/__init__.py", line 7, in <module>
import pkg_resources
File "/home/bakhytgul/anaconda3/lib/python3.6/site-packages/pkg_resources.py", line 1435, in <module>
register_loader_type(importlib_bootstrap.SourceFileLoader, DefaultProvider)
AttributeError: module 'importlib._bootstrap' has no attribute 'SourceFileLoader'

你能帮我解决这个问题吗?十分感谢。我在用着:- Ubuntu 16.04。 (64位)- Python 2.7.12- Python 3.6.0::Anaconda 4.3.1(64 位)

P.S:我已经尝试使用 dotenv 和 ensurepip 进行修复(这让我回答说我没有这个包)。

最佳答案

不是完整的答案,因为我无法告诉您为什么会这样,但希望这能帮助您找到解决方案。

我一直在用 venv 遇到这个问题。当我从头开始尝试构建 rjsmin 时,一切顺利,那时我注意到失败的原因是 venv 使用的是 Python 3.6,而新的 venv 使用的是 Python 3.7。

根据您的控制台输出,您拥有的 anaconda 使用的是 3.6,我认为您可能已经通过使用 pip 手动升级包来破坏了安装。您可以尝试获取更新版本的 anaconda,或者进行全新安装。

关于python - 属性错误 : module 'importlib._bootstrap' has no attribute 'SourceFileLoader' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54587298/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com