代码:
from .packages import six
from .packages.six.moves.http_client import HTTPConnection as _HTTPConnection
from .packages.six.moves.http_client import HTTPException # noqa: F401
报错:
ImportError: attempted relative import with no known parent package
解决办法:
将相对路径换为绝对路径
from urllib3.packages import six
from urllib3.packages.six.moves.http_client import HTTPConnection as _HTTPConnection
from urllib3.packages.six.moves.http_client import HTTPException # noqa: F401