一.  安装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. 把http网站改为Https网站

    腾讯云申请完证书后添加到服务器的方法: https://www.qcloud.com/document/product/400/4143#2.-nginx.E8.AF.81.E4.B9.A6.E9.8 ...

  2. poj1067-取石子游戏 (威佐夫博弈)

    http://poj.org/problem?id=1067 取石子游戏 Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 36 ...

  3. ubuntu Qt5 opencv3.4 项目配置

    #------------------------------------------------- # # Project created by QtCreator 2019-03-25T14:14 ...

  4. ubuntu16.04 qt opencv3.4

    #------------------------------------------------- # # Project created by QtCreator 2018-12-12T14:53 ...

  5. 273. Integer to English Words数字转为单词

    [抄题]: Convert a non-negative integer to its english words representation. Given input is guaranteed ...

  6. mysql5.6配置semi_sync

    测试环境:Red Hat Enterprise Linux Server release 6.3 (Santiago)Server version: 5.6.22-log MySQL Communit ...

  7. jvisualvm远程监控服务器tomcat

    1.在 {服务器tomcat路径}/bin/catalina.sh 中,的[# OS specific support.  $var _must_ be set to either true or f ...

  8. Spring boot 开发组件

    一.Jboot 描述:Jboot是一个基于jfinal 和 undertow开发的微服务框架.提供了AOP.RPC.分布式缓存.限流.降级.熔断.统一配置中心.swagger api自动生成.Open ...

  9. jquery删除记录弹出提示框

    来自于<jquery权威指南> ------------------- 点击删除时,弹出提示框,并做相应的删除确定或取消 完整代码如下: <!DOCTYPE html PUBLIC ...

  10. linux进入单用户方法-乾颐堂

    RedHat7.2 在使用GRUB引导程序的时候如何进入单用户 1.在出现GURB引导画面时,按字母e,进入GRUB编辑状态 2在引导菜单后添加“1”或single,选定它,然后按字母b,就可引导到单 ...