我无法在python 3.8中使用urllib3或urllib

时间:2020-07-12 17:02:27

标签: python urllib urllib3

我刚刚使用pip命令安装了urllib3并成功,当我使用import urllib3import urllib时,它显示了一个巨大的错误。为什么会这样?请帮忙。

这是我的错误:使用import urllibimport urllib3并以高品质文字运行时。

Traceback (most recent call last):
  File "C:\Users\Toshiba\Desktop\dd.py", line 1, in <module>
    import urllib3
  File "C:\Users\Toshiba\AppData\Local\Programs\Python\Python38-32\lib\site-packages\urllib3\__init__.py", line 7, in <module>
    from .connectionpool import HTTPConnectionPool, HTTPSConnectionPool, connection_from_url
  File "C:\Users\Toshiba\AppData\Local\Programs\Python\Python38-32\lib\site-packages\urllib3\connectionpool.py", line 11, in <module>
    from .exceptions import (
  File "C:\Users\Toshiba\AppData\Local\Programs\Python\Python38-32\lib\site-packages\urllib3\exceptions.py", line 2, in <module>
    from .packages.six.moves.http_client import IncompleteRead as httplib_IncompleteRead
  File "C:\Users\Toshiba\AppData\Local\Programs\Python\Python38-32\lib\site-packages\urllib3\packages\six.py", line 199, in load_module
    mod = mod._resolve()
  File "C:\Users\Toshiba\AppData\Local\Programs\Python\Python38-32\lib\site-packages\urllib3\packages\six.py", line 113, in _resolve
    return _import_module(self.mod)
  File "C:\Users\Toshiba\AppData\Local\Programs\Python\Python38-32\lib\site-packages\urllib3\packages\six.py", line 82, in _import_module
    __import__(name)
  File "C:\Users\Toshiba\AppData\Local\Programs\Python\Python38-32\lib\http\client.py", line 71, in <module>
    import email.parser
  File "C:\Users\Toshiba\AppData\Local\Programs\Python\Python38-32\lib\email\parser.py", line 12, in <module>
    from email.feedparser import FeedParser, BytesFeedParser
  File "C:\Users\Toshiba\AppData\Local\Programs\Python\Python38-32\lib\email\feedparser.py", line 27, in <module>
    from email._policybase import compat32
  File "C:\Users\Toshiba\AppData\Local\Programs\Python\Python38-32\lib\email\_policybase.py", line 9, in <module>
    from email.utils import _has_surrogates
  File "C:\Users\Toshiba\AppData\Local\Programs\Python\Python38-32\lib\email\utils.py", line 31, in <module>
    import urllib.parse
  File "C:\Users\Toshiba\Desktop\urllib.py", line 2, in <module>
    from urllib3 import PoolManager
ImportError: cannot import name 'PoolManager' from partially initialized module 'urllib3' (most likely due to a circular import) (C:\Users\Toshiba\AppData\Local\Programs\Python\Python38-32\lib\site-packages\urllib3\__init__.py)

1 个答案:

答案 0 :(得分:2)

中的文件“ C:\ Users \ Toshiba \ Desktop \ urllib.py”,第2行

您的一个文件称为urllib。重命名。

这是问题之一,但我不确定这是您问题的根本原因。看来您的安装已损坏。如果重命名该文件无济于事,建议您从新的virtualenv开始。如果您不使用它,请从此开始。