Scrapy:No module named 'h2'
发布时间丨2024-06-20 08:53:23作者丨zhaomeng浏览丨3
Scrapy 运行报如下的错误:scrapy.exceptions.NotSupported: Unsupported URL scheme 'https': No module named 'h2' File "/usr/local/lib/python3.9/site-packages/twisted/internet/defer.py", line 1657, in _inlineCallbacks result = current_context.run( File "/usr/local/lib/python3.9/site-packages/twisted/python/failure.py", line 500, in throwExceptionIntoGenerator return g.throw(self.type, self.value, self.tb) File "/usr/local/lib/python3.9/site-packages/scrapy/core/downloader/middleware.py", line 49, in process_request return (yield download_func(request=request, spider=spider)) File "/usr/local/lib/python3.9/site-packages/scrapy/utils/defer.py", line 67, in mustbe_deferred result = f(*args, **kw) File "/usr/local/lib/python3.9/site-packages/scrapy/core/downloader/handlers/__init__.py", line 74, in download_request raise NotSupported(f"Unsupported URL scheme '{scheme}': {self._notconfigured[scheme]}") scrapy.exceptions.NotSupported: Unsupported URL scheme 'https': No module named 'h2'
解决方案:
由于爬虫环境中按安装了pandas库,因此需要按装h2
pip install h2