gpt4 book ai didi

python - ImportError:无法导入名称解包

转载 作者:太空宇宙 更新时间:2023-11-04 07:37:56 25 4
gpt4 key购买 nike

我已经使用 pip install scrapy 安装了 scrapy。但是在 python shell 中我得到了一个 ImportError:

>>> from scrapy.spider import Spider
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python2.7/dist-packages/scrapy/__init__.py", line 56, in <module>
from scrapy.spider import Spider
File "/usr/local/lib/python2.7/dist-packages/scrapy/spider.py", line 7, in <module>
from scrapy.http import Request
File "/usr/local/lib/python2.7/dist-packages/scrapy/http/__init__.py", line 10, in <module>
from scrapy.http.request import Request
File "/usr/local/lib/python2.7/dist-packages/scrapy/http/request/__init__.py", line 15, in <module>
from scrapy.utils.url import escape_ajax
File "/usr/local/lib/python2.7/dist-packages/scrapy/utils/url.py", line 10, in <module>
import urllib
File "urllib.py", line 1, in <module>
import urllib2, json
File "/usr/lib/python2.7/urllib2.py", line 112, in <module>
from urllib import (unwrap, unquote, splittype, splithost, quote,
ImportError: cannot import name unwrap

对于 scrapy shell,我也遇到了同样的错误。所以我用 autoremove 卸载了 scrapy 并再次安装它但没有改变。我错过了什么吗?

最佳答案

看起来您已经定义了一个名为 urllib.py 的模块,它隐藏了内置的 urllib 模块。删除/重命名文件。

关于python - ImportError:无法导入名称解包,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30077534/

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