使用Scrapy时遇到:UserWarning: You do not have a working installation of the service_identity module

当我们使用scrapy进行爬虫项目的操作时,出现如下错误:

UserWarning: You do not have a working installation of the service_identity module: ‘cannot import name ‘opentype’’. Please install it from https://pypi.python.org/pypi/service_identity and make sure all of its dependencies are satisfied. Without the service_identity module, Twisted can perform only rudimentary TLS client hostname verification. Many valid certificate/hostname mappings may be rejected.

如图:

UserWarning.png

从提示错误来看,我们需要安装一个模块service_identity,根据提示地址[https://pypi.python.org/pypi/service_identity]来安装,那么我们按照这个来进行安装能解决问题吗?可以试一下。

service_identity.png

我们可以直接通过命令行下载,
sudo pip3 install service_identity-17.0.0-py2.py3-none-any.whl

如果上面的方法没能解决问题,很大可能是有些包的版本不一样导致的,这个时候我们可以用下面这行代码来强制更新。
sudo pip3 install service_identity --force --upgrade

至此,恭喜您成功解决问题,祝您生活愉快!

猜你喜欢

转载自blog.csdn.net/niubiqigai/article/details/82825689
今日推荐