1.安装Python
1)下载paython脚本(可以下载配置好的,里面有很多的Python依赖)
wget ftp://公司服务器/pub/tool/linux-tools/Anaconda2-4.0.0-Linux-x86_64.sh
2),安装
sh Anaconda2-4.0.0-Linux-x86_64.sh 安装后可执行以下命令进行测试:
pip list|grep redis
pip list|grep Mysql
pip search mysql
pip search mysql|less
pip search postgres
pip search hdfs
pip install hdfs
进入命令行:
ipython (ipython要比python强大一些)
2.安装scrapy
pip install scrapy
如果安装过程中报“ error: command ‘gcc’ failed with exit status 1”,可执行“yum install gcc python-devel”
3.安装psycopg2
pip install psycopg2
psycopg2,是Python语言的PostgreSQL数据库接口
运行文件
进入到该文件所在的目录然后执行:scrapy crawl 文件名