Installing scrapy on mac - pyasn1 distribution not found

一笑奈何 提交于 2019-12-06 05:51:39

问题


I have installed scrapy on my mac (OS El Capital, 10.11.4), there does not seem to be any compatibilty problem between scrapy and my python version (2.7.11) but when I try to start a project with scrapy startproject tutorial I get following error message:

pkg_resources.DistributionNotFound: The 'pyasn1' distribution was not 
found and is required by service-identity

I have tried updating both the pyasn1 and the service identity package, but that did not change anything. I have not found any help regarding this specific problem.

Has anyone ever experienced a similar problem? Is there a solution (even a "brutal" one, like uninstalling everything to start from scratch)?


回答1:


There is no need to install everything from scratch. I suggest you to build scrapy in a separate python environment. In my case, a simple pip install cryptography in my environment solved this issue.




回答2:


I found that the problem was due to El Capitan getting rid of openssl headers. This was causing cryptography build to fail.

I found the answer by following: Install Scrapy on OS X El Capitan

The important parts are:

brew install openssl
env LDFLAGS="-L$(brew --prefix openssl)/lib" CFLAGS="-I$(brew --prefix openssl)/include" pip install cryptography  
pip install --upgrade scrapy


来源:https://stackoverflow.com/questions/36954983/installing-scrapy-on-mac-pyasn1-distribution-not-found

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!