scrapy出错,could not build wheel for cryptography"/>
debian安装scrapy出错,could not build wheel for cryptography
pip安装scrapy,安装到cryptography == 2.8时报错could not build wheel for cryptography,后面还有一段大概意思是依赖PEP 517,又不能直接安装。
网上搜了些方法,说要降版本,于是安装了较低版本的cryptography(好像是2.1.4),安装成功。scrapy也能运行,但是每次都提示两个错误
1.service_identity module:cannot import name ‘opentype’,一些功能可能受影响等等
2.module lib has noattribute ‘X509_up_ref’
安装pyOpenSSL == 19.0.0,cryptography == 2.3后不再报错误2。但scrapy运行时会提示WARNING: Remote certificate is not valid for hostname。上网查还是错误1引起的,而service_identity又依赖cryptography2.8,问题又转回来了。
最后搜到办法
Failed Building Wheel for Cryptography
I’ve gotten this problem several times, and it can be caused by different things. I found a few posts that helped me (here and here and here), but here is a quick summary which should help you in almost all situations:
1 Install dependencies (including gcc, which although included by default almost always, is removed in the python-slim packages which are used as an example for docker getting started)
sudo -H apt-get install build-essential libssl-dev libffi-dev python-dev gcc
If any of these packages are already installed, try removing them then running the same line again:
sudo -H apt-get uninstall build-essential libssl-dev libffi-dev python-dev gcc
For some reason removing it then adding it again worked most for me. Also, if you don’t use the -H flag it might say the program/folder don’t belong to the specified user, which means it failed.
2 When setting up your Dockerfile for the first time, make sure not to use python 2.7 slim, as stated slim packages trim a lot, including gcc which is needed for the Cryptography wheel. This was one of the more frustrating issues to fix, so I’m stating it specifically.
3 Making sure docker-py is installed, which allows docker to interface with python, and is used for apps that interface with docker:
sudo pip install docker-py
Installing openssl would probably be a good idea, as it is used in several libraries. I’ve run into a few errors involving libssl, which I believe is part of openssl and can be solved by installing the full library.
使用1,3条提供的方法,发现自己没装libssl-dev,libffi-dev。安装后再装cryptography2.8和service_identity成功。
相关链接
/
更多推荐
debian安装scrapy出错,could not build wheel for cryptography
发布评论