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_ ...
随机推荐
- springcloud 1.5 与 springcloud 2.0 配置区别
eureka配置区别: 1.5:${spring.cloud.client.ipAddress}:${server.port} 2.0:${spring.cloud.client.ip-address ...
- springboot项目实用代码整理
// 判断JSONOBJECT是否为空 CommonUtils.checkJSONObjectIsEmpty(storeInfo) // 判断字符串是否为空," "也为空 Stri ...
- sysfs和kobject
sysfs文件系统: sysfs是2.6内核的一个特性,它允许内核代码经由一个in-memory的文件系统把信息出报(export)到用户进程中. 在设备模型中,sysfs文件系统用来表示设备的结构. ...
- Device doesn't support wireless sync. AMDeviceStartService
Flutter1.9.1+hotfix2 Dart2.5 在iOS13真机上启动不了 错误信息 Device doesn't support wireless sync. AMDeviceStartS ...
- MySQL常见问题集锦及注意事项
一.表设计上的坑 1.字段设计 1.1 字段类型设计 尽量使用整型表示字符串: `INET_ATON(str)`,address to number `INET_NTOA(number)`,numbe ...
- Linux 非互联网环境安装依赖包
1 介绍 有的生产环境是没有网络的,我们部署rpm包的时候会出现缺少很多rpm包的依赖问题,都去网上下载实在太麻烦,今天介绍一个办法可以解决这一问题. 2 解决方案 找一台可以联网的机器,在上边下载相 ...
- 运行 jcontrol 报 libXext.so.6: cannot open shared object file 错误
需要安装额外库: yum install libXext.x86_64 yum install libXrender.x86_64 yum install libXtst.x86_64
- 记录一下JProfiler的使用
刚入职实习,第四天了,昨晚老大安排我在公司机器上装个JProfiler看一情况. 然后网上都是什么跟tomcat一起使用的,所以折腾了很久才搞出来. 我这里没用什么服务器,因为公司用的是Play!框架 ...
- TLS1.3 PPT 整理
1.握手协议的目的是什么 建立共享秘钥(通常使用公钥加密).协商算法和模型以及加密使用的参数,验证身份. 2.记录协议 传输独立的信息,在堆成加密算法下保护数据传输 3.RSA Handshake S ...
- 【问题】yum安装软件报错ERROR:dbus.proxies
转自:Yum安装报错:ERROR:dbus.proxies 环境: [红帽企业Linux.6.4.服务器版].rhel-server-6.4-x86_64-dvd(ED2000.COM).iso 安装 ...