一.  安装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. 32. Longest Valid Parentheses (Stack; DP)

    Given a string containing just the characters '(' and ')', find the length of the longest valid (wel ...

  2. Opencv Convex Hull (凸包)

    #include <iostream>#include <opencv2/opencv.hpp> using namespace std;using namespace cv; ...

  3. StringBuffer详解

  4. CCScrollView练习

    MyScrollItem是CCScrollView容器内项的接口,MyScrollView主要处理添加子节点和事件的处理,MyScrollViewTestItem是对MyScrollItem实现的测试 ...

  5. 633E Binary Table

    传送门 分析 我们发现n特别小,所以可以从这里入手 我们记录出所有列中某一种状态的列有多少个 我们再记录出每种列最少有多少个1(原来的1的个数和取反后的个数去最小值) 于是我们可以得出对于所有列异或一 ...

  6. [Fiddler]如何让Fiddler可以抓取https的请求

    Fiddler通过在本机开启了一个http的代理服务器来进行http请求和响应转发,默认情况下,并不能抓取https的请求.下面小编就来介绍下,如何用fiddler来抓取https的请求. 1.打开F ...

  7. 如何查看HBase的HFile

    记一个比较初级的笔记. ===流程=== 1. 创建一张表 2. 插入10条数据 3. 查看HFile ===操作=== 1.创建表 package api; import org.apache.ha ...

  8. funk_SVD 个人理解

    目标函数: $ J = \frac{1}{2} \left\| R - PQ \right\|^{2} + \lambda \left( \left\|P \right\|^{2} +\left\| ...

  9. jQuary总结6:元素的操作

    1 empty方法 //html <div> <p></p> <span></span> </div> //js $('div) ...

  10. .NET基础 (02).NET运行机制

    .NET运行机制1 .NET程序被编译成什么形式的代码2 JIT是如何工作的3 简述程序集的加载机制4 如何配置程序集的版本策略 1 .NET程序被编译成什么形式的代码 .NET程序在编写完成后,会经 ...