簡體   English   中英

為python3安裝Scrapy時出錯

[英]Error while installing Scrapy for python3

我使用PIPUbuntu安裝ScrapyPython3

sudo pip3 install scrapy

安裝時出現此錯誤

x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/python3.5m -c src/twisted/test/raiser.c -o build/temp.linux-x86_64-3.5/src/twisted/test/raiser.o
    src/twisted/test/raiser.c:4:20: fatal error: Python.h: No such file or directory
    compilation terminated.
    error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

Command "/usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-_il8a07a/Twisted/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-9935fpm4-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-_il8a07a/Twisted/

如前所述,您缺少開發依賴項

對於python 2

sudo apt install -y python-dev
sudo pip install scrapy

對於python 3

sudo apt install -y python3-dev
sudo pip3 install scrapy

運行以下命令

sudo apt install -y python3-dev

之后安裝scrapy

sudo pip3 install scrapy

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM