![](/img/trans.png)
[英]libxml2 or lxml error when trying to run the command “scrapy crawl test”
[英]Receiving an error when trying to run 'scrapy crawl'
運行“ scrapy crawl word”后,我收到一條錯誤消息。 我正在嘗試使用Scrapy刮擦fda網站。 我正在在線學習教程。 這是我的代碼:
import scrapy
class WordSpider(scrapy.Spider):
name = "word"
def start_requests(self):
start_url = [
'https://www.fda.gov/Safety/Recalls/'
]
def parse(self, response):
page = response.url
filename = 'www.fda-%s.html' % page
with open(filename, 'wb') as f:
f.write(response.body)
我已經更改了一些代碼,因為我只需要一個URL,而'www'對於鏈接的工作很重要。
我得到的錯誤是:
:0: UserWarning: You do not have a working installation of the service_identity module: 'No module named cryptography.x509'.
我嘗試安裝service_identity,但收到相同的錯誤。 不知道我的代碼是否錯誤或缺少某些軟件包。
似乎您缺少一些TLS軟件包,我建議您安裝加密和OpenSSL軟件包。
pip install cryptography
OpenSSL:
brew install openssl
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.