centos 7安装python3及相关模块

一、python3安装

1、cd /usr/bin

2、mv python python.bak

3、https://www.python.org/ftp/python/网站选择合适的版本

4、wget https://www.python.org/ftp/python/3.6.x/Python-3.6.x.tar.xz

5、tar -xvJf  Python-3.6.2.tar.xz

6、cd Python-3.6.x

7、./configure prefix=/usr/local/python3

8、make && make install

9、ln -s /usr/local/python3/bin/python3 /usr/bin/python

 

二、解决yum不能使用问题:

  a、vi /usr/bin/yum

  b、vi /usr/libexec/urlgrabber-ext-down

  c、将首行python改为python2.7

 

三、模块安装

1、scrapy

  a、yum -y install epel-release

  b、yum install -y python-pip

  c、yum install -y python-devel

  d、pip install scrapy

2、scrapy-redis

  a、pip install scrapy-redis

posted @ 2019-01-02 12:06  hougang  阅读(790)  评论(0编辑  收藏  举报