[scrapy-redis] install and configure scrapy-redis on CentOS 7 (1)

0. 安装依赖

yum install -y zlib zlib-devel openssl openssl-devel bzip2 bzip2-devel sqlite-devel gcc wget

1. 安装 python 3.6.4

下载源代码并编译

wget --no-check-certificate https://www.python.org/ftp/python/3.6.4/Python-3.6.4.tgz  //下载源码

tar -zxvf Python-3.6.4.tgz  //解压

cd Python-3.6.4

./configure --prefix=/usr/local
  //安装到/usr/local目录

make && make altinstall //编译&&安装

检查python3.6.4是否安装成功

cd /usr/local/bin

ls

可以看到python3.6,pip3.6

[root@localhost bin]# python3.6
Python 3.6.4 (default, May 30 2018, 17:52:21) 
[GCC 4.8.5 20150623 (Red Hat 4.8.5-16)] on linux
Type "help", "copyright", "credits" or "license" for more information.

修改软链接

这是未修改时的/usr/bin

  • 只修改python3,这样就不会影响yum和其他程序的运行
cd /usr/bin

ln -s /usr/local/bin/python3.6 /usr/bin/python3
ln -s /usr/local/bin/pip3.6 /usr/bin/pip3

ls -lt /usr/bin/python* //查看此目录下的软链接

2. install Twisted


pip3 install setuptools_scm

wget --no-check-certificate https://twistedmatrix.com/Releases/Twisted/17.1/Twisted-17.1.0.tar.bz2

tar -jxvf Twisted-17.1.0.tar.bz2

cd Twisted-17.1.0

python3 setup.py install

3. install scrapy-redis

pip3 install scrapy-redis

4. install redis

yum install -y redis //如果出现 No Package available 执行以下两步再安装

yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm

yum update
vi /etc/redis.conf

bind 127.0.0.1这一行用#注释掉

启动redis服务器

systemctl start redis
redis-cli -h [ip] -p [port]

solutions

1. backspace ^H

Reference

  1. Python3 Linux安装(Redhat)

  2. CentOS 7升级Python到3.5后yum出错

  3. CentOS 安装Scrapy

  4. Python3、setuptools、Pip3安装详解

  5. How to install the latest version of Python on CentOS

posted @ 2018-05-30 15:12  arcsinW  阅读(293)  评论(0编辑  收藏  举报