[CentOS7] 安裝python scrapy庫

refer and revise from https://clasense4.wordpress.com/2015/11/25/how-to-install-scrapy-on-centos-7/ 



please sudo all automatically...



#set swap

sudo dd if=/dev/zero of=/swapfile count=4096 bs=1MiB

#instead of original command : sudo fallocate -l 4G /swapfile , 'cause it didn't work on my CentOS ...

sudo chmod 600 /swapfile

sudo mkswap /swapfile

sudo swapon /swapfile

echo "/swapfile swap swap sw 0 0" >> /etc/fstab

echo "vm.swappiness = 10" >>/etc/sysctl.conf

echo "vm.vfs_cache_pressure = 50" >> /etc/sysctl.conf



#install scrapy

sudo rpm -Uvh http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-7.noarch.rpm

#pay attention on version

yum update -y

yum install python-pip -y

yum install python-devel -y

yum install gcc gcc-devel -y

yum install libxml2 libxml2-devel -y

yum install libxslt libxslt-devel -y

yum install openssl openssl-devel -y

yum install libffi libffi-devel -y

pip install --upgrade pip

CFLAGS="-O0" pip install lxml

pip install scrapy



#check scrapy install successfully

scrapy -v



----------我是分割線----------



之後割太多記憶體,想刪swap刪不掉,上網查了一下,要先停止swap的使用



swapoff -v /swapfile


rm /swapfile


 



 



留言

這個網誌中的熱門文章

[Antergos] disable touchpad

[Editor] 入坑 Atom => Markdown 轉 PDF