centos6安装Python3环境
Python3安装
CentOS 6+系统默认安装的python版本是2.6.6,python2版本与python3还有有一些语法上的不一样。我们要把python升级到3版本,但是系统自带的旧版本python被系统很多其他软件环境依赖,所以不能直接卸载原来的2版本,所以我们重新安装一个3版本,将2版本的依赖保留。
1、下载Python安装包
源码包下载地址:https://www.python.org/ftp/python/3.6.0/Python-3.6.0.tgz
2、安装源码编译器等工具:
[root@bigdata-pro03 softwares]# yum -y install gcc gcc-c++ autoconf automake make zlib zlib-devel
3、解压下好的源码包:
[root@bigdata-pro03 softwares]# tar -xzvf Python-3.6..tgz
[root@bigdata-pro03 softwares]# cd /opt/modules/Python-3.6./
[root@bigdata-pro03 Python-3.6.]# ls
aclocal.m4 configure Grammar Lib Makefile.pre.in Objects PCbuild Python Tools
config.guess configure.ac Include LICENSE Misc Parser Programs README
config.sub Doc install-sh Mac Modules PC pyconfig.h.in setup.py
4、编译安装包,指定安装路径:
注意:prefix参数用于指定将Python安装在新目录,这样不会覆盖原有的python。
./configure --prefix=/usr/local/python36
make && make install
5、修改系统默认的Python路径,因为默认的python指向2.6
mv /usr/bin/python /usr/bin/python-2.6.
6、建立新的软连接,指向Python-3.6.0:
注:这里的python36是第4步指定的安装路径,python3.6是Python包里的可执行程序
ln -s /usr/local/python36/bin/python3. /usr/bin/python
7、因为yum是依赖python的,所以这里我们修改了默认的python,就要要修改yum,让其运行指向旧的版本:
vim /usr/bin/yum 将第一行“#!/usr/bin/python” 修改为“#!/usr/bin/python-2.6.”
8、测试按是否安装成功
[root@bigdata-pro02 Python-3.6.]# python
Python 3.6. (default, Nov , ::)
[GCC 4.4. (Red Hat 4.4.-)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>
可以看到,已经成功安装Python3.6.0!
pip3安装
1、下载安装文件,使用python命令进行安装
wget --no-check-certificate https://bootstrap.pypa.io/get-pip.py
python get-pip.py
2、为pip建立软连接,使用pip命令安装requests模块
ln -s /usr/local/python36/bin/pip3. /usr/bin/pip
pip -V
pip install requests
[root@bigdata-pro03 gcc-build-9.2.]# pip Usage:
pip <command> [options] Commands:
install Install packages.
download Download packages.
uninstall Uninstall packages.
freeze Output installed packages in requirements format.
list List installed packages.
show Show information about installed packages.
check Verify installed packages have compatible dependencies.
config Manage local and global configuration.
search Search PyPI for packages.
wheel Build wheels from your requirements.
hash Compute hashes of package archives.
completion A helper command used for command completion.
debug Show information useful for debugging.
help Show help for commands. General Options:
-h, --help Show help.
--isolated Run pip in an isolated mode, ignoring environment variables and user configuration.
-v, --verbose Give more output. Option is additive, and can be used up to times.
-V, --version Show version and exit.
-q, --quiet Give less output. Option is additive, and can be used up to times (corresponding to WARNING, ERROR,
and CRITICAL logging levels).
--log <path> Path to a verbose appending log.
--proxy <proxy> Specify a proxy in the form [user:passwd@]proxy.server:port.
--retries <retries> Maximum number of retries each connection should attempt (default times).
--timeout <sec> Set the socket timeout (default seconds).
--exists-action <action> Default action when a path already exists: (s)witch, (i)gnore, (w)ipe, (b)ackup, (a)bort.
--trusted-host <hostname> Mark this host or host:port pair as trusted, even though it does not have valid or any HTTPS.
--cert <path> Path to alternate CA bundle.
--client-cert <path> Path to SSL client certificate, a single file containing the private key and the certificate in PEM
format.
--cache-dir <dir> Store the cache data in <dir>.
--no-cache-dir Disable the cache.
--disable-pip-version-check
Don't periodically check PyPI to determine whether a new version of pip is available for download.
Implied with --no-index.
--no-color Suppress colored output
到此,Centos系统下的Python3环境就搭建完成了!
centos6安装Python3环境的更多相关文章
- CentOS安装python3环境
CentOS7.4安装python3环境 (Python 3.8.1) (stable version, Dec.18, 2019) # .从官网下载Python - Dec. , [stable v ...
- Mac 10.12下安装python3环境
python3感觉用虚拟环境会比较好操作一些,也不用直接卸载python2. 一.基于brew快速安装 # 安装python3 brew install python3 # 安装pip(好像3自带pi ...
- Linux服务器超简单安装Python3环境、Ipython、Jupyter、virtualenv、virtualenvwrapper教程全在这了
一.网卡配置 vim /etc/sysconfig/network-scripts/ifcfg-ens33 ONBOOT='yes' 二.更换Linux语言环境 1.修改配置文件 vim /etc/l ...
- centos7.4上安装python3环境的坑
前言:为了将爬虫项目布置到服务器上,才有了今天这一下午的坑,必须记录 不要动现有的python2环境!不要动现有的python2环境!不要动现有的python2环境! 解压 tar -xvf Pyth ...
- 大数据学习之路-Centos6安装python3.5
Centos 6.8安装python3.5.2 因为学习所需,需要用到python3.x的环境,目前Linux系统默认的版本都是python2.x的,还有一些自带的工具需要用到python2.6版本, ...
- Linux下安装python3环境搭建
Linux下python3环境搭建 Linux安装软件有哪些方式? rpm软件包 手动安装 拒绝此方式 需要手动解决依赖关系 yum自动化安装 自动处理依赖关系 非常好用 源代码编译安装,可自定义的功 ...
- CentOS下安装python3环境及pypy环境
安装前基础环境 1. win7虚拟机CentOS7.6系统 2. 网络环境通过NAT方式 3. 已经配置到yum仓库并系统自带有python2.7 安装前准备 1. python3.6.5源码包:ht ...
- centos6安装python3.4和pip3
在安装了epel源的情况下,直接yum就可以安装python3.4 yum install python34 -ypython3 --version 没有自带pip3,从官网安装 wget --no- ...
- centos 7.6安装python3环境
Centos7安装Python3的方法 由于centos7原本就安装了Python2,而且这个Python2不能被删除,因为有很多系统命令,比如yum都要用到. [root@VM_105_217_ ...
随机推荐
- web开发工具flask中文英文书籍-持续更新
web开发工具flask中文英文书籍-持续更新 python测试开发_AI命理关注 0.9222018.11.10 07:48:43字数 625阅读 885 python测试开发项目实战-目录 pyt ...
- css 点击样式,水波纹(记录备用)
<!DOCTYPE html><html lang="en"> <head> <meta charset="UTF-8" ...
- Sharding-JDBC介绍
Sharding-JDBC是当当应用框架ddframe中,从关系型数据库模块dd-rdb中分离出来的数据库水平分片框架,实现透明化数据库分库分表访问.Sharding-JDBC是继dubbox和ela ...
- tree 树形加载及增删改
//异步1<template> <div class="addequipment org"> <div class="top"&g ...
- jquery事件委托详解
jQuery事件委托处理流程 上一章分析jQuery.event.add的时候已经分析了事件绑定,再把绑定的部分源码抽出来 if ( !(eventHandle = elemData.handle) ...
- 发现一个对列排版挺好用的命令:column
help [root@hdpool1 tmp]# column -h Usage: column [options] [file ...] Options: -c, --columns <wid ...
- 如何在SAP云平台ABAP编程环境里创建自己的Z表
选中ABAP包,右键创建一个新的Database Table: 维护表名为ZBOOKING: 表实现的源代码: @EndUserText.label : 'Jerry''s booking' @Aba ...
- python3之面向对象编程理解
面向对象主要有三个特征:封装,继承,多态度. 一.封装 定义类语 class Animal(): class为定义类的关键字,后面跟名字(): python命名规范建议:类一般首字母单词大写,属性变量 ...
- soapUI与post测试soap webservice接口
之前装了SoapUI,最近装了Postman,分别用它们测试了WebService,下面为用法. 测试的在线WebService(数据来源于中国气象局)Endpoint: http://www.web ...
- Python标准库3.4.3-urllib.request-21.6
21.6. urllib.request — Extensible library for opening URLs 翻译:Z.F. The urllib.request module defines ...