一.  安装python3并设为默认版本,与python2共存

1、下载Python3.4安装包

   wget https://www.python.org/ftp/python/3.4.4/Python-3.4.4.tgz

2、解压、编译、安装

yum install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gcc make

  tar zxvf Python-3.4.4.tgz
cd Python-3.4.4
./configure --prefix=/usr/local/python3
make
make install

3、创建Python3.4的链接,并且设置python3为默认版本(CentOS6.7默认安装的是Python2)

cd /usr/bin/

ln -s /usr/local/python3/bin/python3.4 python   #如果不想为默认版本,把python改为python3

4.  因为执行yum需要python2版本,所以我们还要修改yum的配置

vi /usr/bin/yum 把#! /usr/bin/python修改为#! /usr/bin/python2

二.  安装模块

1. 安装beautifulsoup

   tar xvzf beautifulsoup4-4.5.1.tar.gz
   cd beautifulsoup4-4.5.1 
   python setup.py install

2. 安装requests

   wget https://bootstrap.pypa.io/get-pip.py
   python get-pip.py 
   pip install requests
 
3. 安装lxml,依赖有libxml2-devel,libxslt-devel
    yum install libxml2-devel libxslt-devel -y
    pip install lxml


centos6装python3,并安装requests, lxml和beautifulsoup模块的更多相关文章

  1. Windows上Python3.5安装Scrapy(lxml) 以及与twisted有关错误的解决

    转载于:http://www.cnblogs.com/silverbullet11/p/4966608.html 常用网址: Python 3.5: https://www.python.org/do ...

  2. Windows上Python3.5安装Scrapy(lxml)

    常用网址: Python 3.5: https://www.python.org/downloads/ Wheel文件:http://www.lfd.uci.edu/~gohlke/pythonlib ...

  3. linux/centos6.5下编译安装python2.7和python3.5.2

    centos6.5环境下安装python2.7 解压python源码包 tar -xf Python-2.7.6.tar.xz 进入软件包目录 cd Python-2.7.6 添加配置项 ./conf ...

  4. Centos6下Python3的编译安装

    本文转载自 Centos6下Python3的编译安装 系统环境:CentOS 6.8-Minimal 安装Python依赖包: 1 [root@Python src]# yum install zli ...

  5. Python3.x(windows系统)安装requests库

    Python3.x(windows系统)安装requests库 cmd命令: pip install requests 执行结果:

  6. python3.6安装lxml库

    好像是在python3.5之后,安装了lxml也无法使用etree 为了就解决这个问题使用如下方法: 1.下载lxml的wheel文件,下载地址:https://www.lfd.uci.edu/~go ...

  7. Python3安装Requests

    安装Requests费了1天的时间,囧.终于还是在官网找到解决方法,可以参考这个http://docs.python-requests.org/en/latest/user/install/#inst ...

  8. Python3.7离线安装Requests无法正常使用问题

    继续搬砖...... 春节前,克服了网络受限的情况下离线安装Python库文件问题,传送门如下: https://www.cnblogs.com/mrgavin/p/12202214.html htt ...

  9. Python3 Scrapy 安装方法

    Python3 Scrapy 安装方法 (一脸辛酸泪) 写在前面 最近在学习爬虫,在熟悉了Python语言和BeautifulSoup4后打算下个爬虫框架试试. 没想到啊,这坑太深了... 看了看相关 ...

随机推荐

  1. 124. Binary Tree Maximum Path Sum (Tree; DFS)

    Given a binary tree, find the maximum path sum. For this problem, a path is defined as any sequence ...

  2. XHTML的规范化

    -------------------siwuxie095                                 XHTML 简介         1.什么是 XHTML?     XHTM ...

  3. 爬虫解析:XPath总结

    1.加载 XML 文档 所有现代浏览器都支持使用 XMLHttpRequest 来加载 XML 文档的方法. 针对大多数现代浏览器的代码: var xmlhttp=new XMLHttpRequest ...

  4. RTX Server SDK跨服务器如何调用

    1.   确认安装RTX Server SDK在开发的机器上必须确认已经安装了RTX Server SDK,并且与RTX Server的版本要一致.该计算机后面我们简称SDK计算机. 2.   步骤2 ...

  5. [C++] Template Function _ Any number of parameters

    Template Function _ Any number of parameters #include<iostream> #include<cstdarg> using ...

  6. Ubuntu命令行下安装、卸载、管理软件包的方法

    一.Ubuntu中软件安装方法 1.APT方式 (1)普通安装:apt-get install softname1 softname2 -; (2)修复安装:apt-get -f install so ...

  7. 给你的LINUX程序加个文字画LOGO

    经常看到很多的程序尤其LINUX程序有文字对应的那种LOGO,好酷炫啊. 研究了好久试了各种方法,后来在GOOGLE中搜索到一个软件叫:figlet 下载地址:http://www.figlet.or ...

  8. Ubuntu14.04下 安装xhprof

    1.下载xhprof包: wget http://pecl.php.net/get/xhprof-0.9.4.tgz 2.解压 进入扩展目录 .tgz cd /home/justphp/xhprof- ...

  9. [GO]使用select实现超时

    package main import ( "fmt" "time" ) func main() { ch := make(chan int) quit := ...

  10. [GO]结构体指针类型匿名字段

    package main import "fmt" type Person struct { name string sex byte age int } type Student ...