centos 7 安装 python3.6 python3 安装步骤以及pip pip3安装挂载
首先去python官网下载python3的源码包,网址:https://www.python.org/
或者直接wget下载
wget https://www.python.org/ftp/python/3.6.4/Python-3.6.4.tgz
#安装python时可能需要依赖包,安装之前最好先安装一下下面的依赖包,网上找到两条命令如下:
[root@qinhan bin]# yum -y install openssl-devel bzip2-devel expat-devel gdbm-devel readline-devel sqlite-devel
yum -y install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gcc make
没有网络的话,哥教你怎么手动安装,有网络可以用yum pip安装的话可以不看
------------------------------------------------zlib 安装开始-------------------------------------------------------------------------------------- 下载zlib1.2.11 http://www.zlib.net/ 我下载的是1..11版本 ./configure --prefix=/usr/local/zlib1_2_11 make make install ------------------------------------------------zlib 安装结束--------------------------------------------------------------------------------------
------------------------------------------------zlib devel 安装开始--------------------------------------------------------------------------------------
http://rpmfind.net/linux/rpm2html/search.php?query=zlib-devel
------------------------------------------------zlib devel 安装开始--------------------------------------------------------------------------------------
zlib-devel包可以到以下连接查找,那么如何找到对应的版本呢我们使用rpm -qi zlib 可以找到对应的版本信息,随后zlib-devel rpm只要根据版本信息去找就可以了,接下来所有的rpm包安装方法参考zlib
http://rpmfind.net/linux/rpm2html/search.php?query=zlib-devel
[root@localhost software_download]# rpm -qi zlib
Name : zlib
Version : 1.2.7
Release : 17.el7
Architecture: x86_64
Install Date: 2018年03月13日 星期二 18时53分26秒
Group : System Environment/Libraries
Size : 185710
License : zlib and Boost
Signature : RSA/SHA256, 2016年11月21日 星期一 05时05分07秒, Key ID 24c6a8a7f4a80eb5
Source RPM : zlib-1.2.7-17.el7.src.rpm
Build Date : 2016年11月06日 星期日 02时09分15秒
Build Host : worker1.bsys.centos.org
Relocations : (not relocatable)
Packager : CentOS BuildSystem <http://bugs.centos.org>
Vendor : CentOS
URL : http://www.zlib.net/
Summary : The compression and decompression library
Description :
Zlib is a general-purpose, patent-free, lossless data compression
library which is used by many different programs.
随后根据版本包找到对应的rpm包
[root@localhost software_download]# ls
zlib-1.2.11 zlib-1.2.11.tar.gz zlib-devel-1.2.7-17.el7.x86_64.rpm
执行rpm -ivh zlib-devel-1.2.7-17.el7.x86_64.rpm 安装
root@localhost software_download]# rpm -ivh zlib-devel-1.2.7-17.el7.x86_64.rpm
警告:zlib-devel-1.2.7-17.el7.x86_64.rpm: 头V3 RSA/SHA256 Signature, 密钥 ID f4a80eb5: NOKEY
准备中... ################################# [100%]
正在升级/安装...
1:zlib-devel-1.2.7-17.el7 ################################# [100%]
------------------------------------------------zlib devel 安装结束--------------------------------------------------------------------------------------
------------------------------------------------bzip2 devel 安装开始--------------------------------------------------------------------------------------
bzip 系统已经安装了,如果没安装,请自行百度
[root@localhost software_download]# rpm -qi bzip2
Name : bzip2
Version : 1.0.6
Release : 13.el7
Architecture: x86_64
Install Date: 2018年03月13日 星期二 18时54分02秒
Group : Applications/File
Size : 83791
License : BSD
Signature : RSA/SHA256, 2015年11月25日 星期三 22时18分37秒, Key ID 24c6a8a7f4a80eb5
Source RPM : bzip2-1.0.6-13.el7.src.rpm
Build Date : 2015年11月20日 星期五 13时04分52秒
Build Host : worker1.bsys.centos.org
Relocations : (not relocatable)
Packager : CentOS BuildSystem <http://bugs.centos.org>
Vendor : CentOS
URL : http://www.bzip.org/
Summary : A file compression utility
Description :
Bzip2 is a freely available, patent-free, high quality data compressor.
Bzip2 compresses files to within 10 to 15 percent of the capabilities
of the best techniques available. However, bzip2 has the added benefit
of being approximately two times faster at compression and six times
faster at decompression than those techniques. Bzip2 is not the
fastest compression utility, but it does strike a balance between speed
and compression capability.
Install bzip2 if you need a compression utility.
[root@localhost software_download]# rpm -ivh bzip2-devel-1.0.6-13.el7.x86_64.rpm
警告:bzip2-devel-1.0.6-13.el7.x86_64.rpm: 头V3 RSA/SHA256 Signature, 密钥 ID f4a80eb5: NOKEY
准备中... ################################# [100%]
正在升级/安装...
1:bzip2-devel-1.0.6-13.el7 ################################# [100%]
[root@localhost software_download]#
------------------------------------------------bzip2 devel 安装结束--------------------------------------------------------------------------------------
------------------------------------------------openssl devel 安装开始--------------------------------------------------------------------------------------
openssl已经安装
[root@localhost software_download]# rpm -qi openssl
Name : openssl
Epoch : 1
Version : 1.0.1e
Release : 60.el7
Architecture: x86_64
Install Date: 2018年03月13日 星期二 18时54分55秒
Group : System Environment/Libraries
Size : 1611673
License : OpenSSL
Signature : RSA/SHA256, 2016年11月21日 星期一 03时48分52秒, Key ID 24c6a8a7f4a80eb5
Source RPM : openssl-1.0.1e-60.el7.src.rpm
Build Date : 2016年11月06日 星期日 11时49分26秒
Build Host : worker1.bsys.centos.org
Relocations : (not relocatable)
Packager : CentOS BuildSystem <http://bugs.centos.org>
Vendor : CentOS
URL : http://www.openssl.org/
Summary : Utilities from the general purpose cryptography library with TLS implementation
Description :
The OpenSSL toolkit provides support for secure communications between
machines. OpenSSL includes a certificate management tool and shared
libraries which provide various cryptographic algorithms and
protocols.
这个openssl-devel比较麻烦,用Yum看了下需要各种更新,先不装
依赖关系解决
====================================================================================================================================================
Package 架构 版本 源 大小
====================================================================================================================================================
正在安装:
openssl-devel x86_64 1:1.0.2k-12.el7 base 1.5 M
为依赖而安装:
keyutils-libs-devel x86_64 1.5.8-3.el7 base 37 k
krb5-devel x86_64 1.15.1-19.el7 updates 269 k
libcom_err-devel x86_64 1.42.9-12.el7_5 updates 31 k
libselinux-devel x86_64 2.5-12.el7 base 186 k
libsepol-devel x86_64 2.5-8.1.el7 base 77 k
libverto-devel x86_64 0.2.5-4.el7 base 12 k
pcre-devel x86_64 8.32-17.el7 base 480 k
为依赖而更新:
e2fsprogs x86_64 1.42.9-12.el7_5 updates 699 k
e2fsprogs-libs x86_64 1.42.9-12.el7_5 updates 167 k
krb5-libs x86_64 1.15.1-19.el7 updates 747 k
krb5-workstation x86_64 1.15.1-19.el7 updates 814 k
libcom_err x86_64 1.42.9-12.el7_5 updates 41 k
libkadm5 x86_64 1.15.1-19.el7 updates 175 k
libselinux x86_64 2.5-12.el7 base 162 k
libselinux-python x86_64 2.5-12.el7 base 235 k
libselinux-utils x86_64 2.5-12.el7 base 151 k
libsepol x86_64 2.5-8.1.el7 base 297 k
libss x86_64 1.42.9-12.el7_5 updates 45 k
openssl x86_64 1:1.0.2k-12.el7 base 492 k
openssl-libs x86_64 1:1.0.2k-12.el7 base 1.2 M
pcre x86_64 8.32-17.el7 base 422 k
事务概要
====================================================================================================================================================
安装 1 软件包 (+ 7 依赖软件包)
升级 ( 14 依赖软件包)
------------------------------------------------openssl devel 安装结束--------------------------------------------------------------------------------------
------------------------------------------------ncurses devel 安装开始--------------------------------------------------------------------------------------
[root@localhost software_download]# rpm -qi ncurses
Name : ncurses
Version : 5.9
Release : 14.20130511.el7_4
Architecture: x86_64
Install Date: 2018年07月05日 星期四 11时52分01秒
Group : System Environment/Base
Size : 439378
License : MIT
Signature : RSA/SHA256, 2017年09月07日 星期四 20时43分11秒, Key ID 24c6a8a7f4a80eb5
Source RPM : ncurses-5.9-14.20130511.el7_4.src.rpm
Build Date : 2017年09月07日 星期四 06时08分29秒
Build Host : c1bm.rdu2.centos.org
Relocations : (not relocatable)
Packager : CentOS BuildSystem <http://bugs.centos.org>
Vendor : CentOS
URL : http://invisible-island.net/ncurses/ncurses.html
Summary : Ncurses support utilities
Description :
The curses library routines are a terminal-independent method of
updating character screens with reasonable optimization. The ncurses
(new curses) library is a freely distributable replacement for the
discontinued 4.4 BSD classic curses library.
This package contains support utilities, including a terminfo compiler
tic, a decompiler infocmp, clear, tput, tset, and a termcap conversion
tool captoinfo.
[root@localhost software_download]# rpm -ivh ncurses-devel-5.9-14.20130511.el7_4.x86_64.rpm
准备中... ################################# [100%]
正在升级/安装...
1:ncurses-devel-5.9-14.20130511.el7################################# [100%]
[root@localhost software_download]#
------------------------------------------------ncurses devel 安装结束--------------------------------------------------------------------------------------
------------------------------------------------sqlite devel 安装开始--------------------------------------------------------------------------------------
[root@localhost software_download]# rpm -qi sqlite
Name : sqlite
Version : 3.7.17
Release : 8.el7
Architecture: x86_64
Install Date: 2018年03月13日 星期二 18时53分31秒
Group : Applications/Databases
Size : 814231
License : Public Domain
Signature : RSA/SHA256, 2015年11月25日 星期三 23时40分39秒, Key ID 24c6a8a7f4a80eb5
Source RPM : sqlite-3.7.17-8.el7.src.rpm
Build Date : 2015年11月20日 星期五 16时45分59秒
Build Host : worker1.bsys.centos.org
Relocations : (not relocatable)
Packager : CentOS BuildSystem <http://bugs.centos.org>
Vendor : CentOS
URL : http://www.sqlite.org/
Summary : Library that implements an embeddable SQL database engine
Description :
SQLite is a C library that implements an SQL database engine. A large
subset of SQL92 is supported. A complete database is stored in a
single disk file. The API is designed for convenience and ease of use.
Applications that link against SQLite can enjoy the power and
flexibility of an SQL database without the administrative hassles of
supporting a separate database server. Version 2 and version 3 binaries
are named to permit each to be installed on a single host
[root@localhost software_download]# rpm -ivh sqlite-devel-3.7.17-8.el7.x86_64.rpm
警告:sqlite-devel-3.7.17-8.el7.x86_64.rpm: 头V3 RSA/SHA256 Signature, 密钥 ID f4a80eb5: NOKEY
准备中... ################################# [100%]
正在升级/安装...
1:sqlite-devel-3.7.17-8.el7 ################################# [100%]
------------------------------------------------sqlite devel 安装结束--------------------------------------------------------------------------------------
------------------------------------------------readline devel 安装开始--------------------------------------------------------------------------------------
[root@localhost software_download]# rpm -qi readline
Name : readline
Version : 6.2
Release : 9.el7
Architecture: x86_64
Install Date: 2018年03月13日 星期二 18时53分31秒
Group : System Environment/Libraries
Size : 460408
License : GPLv3+
Signature : RSA/SHA256, 2014年07月04日 星期五 12时47分34秒, Key ID 24c6a8a7f4a80eb5
Source RPM : readline-6.2-9.el7.src.rpm
Build Date : 2014年06月10日 星期二 02时52分20秒
Build Host : worker1.bsys.centos.org
Relocations : (not relocatable)
Packager : CentOS BuildSystem <http://bugs.centos.org>
Vendor : CentOS
URL : http://cnswww.cns.cwru.edu/php/chet/readline/rltop.html
Summary : A library for editing typed command lines
Description :
The Readline library provides a set of functions that allow users to
edit command lines. Both Emacs and vi editing modes are available. The
Readline library includes additional functions for maintaining a list
of previously-entered command lines for recalling or editing those
lines, and for performing csh-like history expansion on previous
commands.
网上只有6.2.10版本,把readline-6.2-10.el7.x86_64.rpm 下载下来进行更新操作
[root@localhost software_download]# rpm -Uvh readline-6.2-10.el7.x86_64.rpm
[root@localhost software_download]# rpm -ivh readline-devel-6.2-10.el7.x86_64.rpm
准备中... ################################# [100%]
正在升级/安装...
1:readline-devel-6.2-10.el7 ################################# [100%]
------------------------------------------------readline devel 安装结束--------------------------------------------------------------------------------------
------------------------------------------------tk devel 安装开始--------------------------------------------------------------------------------------
[root@localhost software_download]# rpm -qi tk
未安装软件包 tk
下载tk-8.5.13-6.el7.x86_64.rpm
[root@localhost software_download]# rpm -ivh tk-8.5.13-6.el7.x86_64.rpm
错误:依赖检测失败:
libtcl8.5.so()(64bit) 被 tk-1:8.5.13-6.el7.x86_64 需要
tcl = 1:8.5.13 被 tk-1:8.5.13-6.el7.x86_64 需要
tcl >= 1:8.5.13-5 被 tk-1:8.5.13-6.el7.x86_64 需要
下载tcl-8.5.13-8.el7.x86_64.rpm
[root@localhost software_download]# rpm -ivh tcl-8.5.13-8.el7.x86_64.rpm
准备中... ################################# [100%]
正在升级/安装...
1:tcl-1:8.5.13-8.el7 ################################# [100%]
[root@localhost software_download]# rpm -ivh tk-8.5.13-6.el7.x86_64.rpm
准备中... ################################# [100%]
正在升级/安装...
1:tk-1:8.5.13-6.el7 ################################# [100%]
tk-devel依赖包太多,暂不安装或者用Yum安装吧
依赖关系解决
====================================================================================================================================================
Package 架构 版本 源 大小
====================================================================================================================================================
正在安装:
tk-devel x86_64 1:8.5.13-6.el7 base 488 k
为依赖而安装:
expat-devel x86_64 2.1.0-10.el7_3 base 57 k
fontconfig-devel x86_64 2.10.95-11.el7 base 128 k
freetype-devel x86_64 2.4.11-15.el7 base 356 k
libX11-devel x86_64 1.6.5-1.el7 base 980 k
libXau-devel x86_64 1.0.8-2.1.el7 base 14 k
libXft-devel x86_64 2.3.2-2.el7 base 19 k
libXrender-devel x86_64 0.9.10-1.el7 base 17 k
libxcb-devel x86_64 1.12-1.el7 base 1.0 M
tcl-devel x86_64 1:8.5.13-8.el7 base 165 k
xorg-x11-proto-devel noarch 7.7-20.el7 base 284 k
为依赖而更新:
expat x86_64 2.1.0-10.el7_3 base 81 k
fontconfig x86_64 2.10.95-11.el7 base 229 k
freetype x86_64 2.4.11-15.el7 base 392 k
libX11 x86_64 1.6.5-1.el7 base 606 k
libX11-common noarch 1.6.5-1.el7 base 164 k
libXrender x86_64 0.9.10-1.el7 base 26 k
libxcb x86_64 1.12-1.el7 base 211 k
------------------------------------------------tk devel 安装结束--------------------------------------------------------------------------------------
开始正式安装python3.6
释放文件:
tar -xzvf Python-3.6.4.tgz -C /tmp
进入目录:
cd /tmp/Python-3.6.4
配置安装目录,其他选项一般默认即可:
./configure --prefix=/usr/local/python3 --设立自己的python3目录,所有的python3 的bin lib等文件都放在/usr/local/python3目录下
接下来编译源码:
make
执行安装:
make install
做一个python3的软链接
[root@localhost bin]# ln -s /usr/local/python3/bin/python3.6 /usr/bin/python3
[root@localhost bin]# python3
Python 3.6.4 (default, Jul 5 2018, 12:35:43)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-11)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> exit
Use exit() or Ctrl-D (i.e. EOF) to exit
>>> exit()
做一个pip3的软链接
[root@localhost bin]# ln -s /usr/local/python3/bin/pip3.6 /usr/bin/pip3
[root@localhost bin]# pip3
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.
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.
help Show help for commands.
至此python3已经安装完成了
以下这段看到的网上把原来的python2软链接连接到python3上了,在生产环境千万不要这么做,测试环境可以随便玩
cd /usr/bin
[root@qinhan bin]# ll *python*
lrwxrwxrwx. 1 root root 7 Dec 15 2016 python -> python2
lrwxrwxrwx. 1 root root 9 Dec 15 2016 python2 -> python2.7
-rwxr-xr-x. 1 root root 7136 Nov 20 2015 python2.7
#更改/usr/bin/python链接
[root@qinhan bin]# ln -s /usr/local/bin/python3.6 /usr/bin/python
[root@qinhan bin]# ln -s /usr/local/bin/python3.6 /usr/bin/python3
[root@qinhan bin]# ll *python*
lrwxrwxrwx 1 root root 24 Jan 11 10:10 python -> /usr/local/bin/python3.6
lrwxrwxrwx. 1 root root 9 Dec 15 2016 python2 -> python2.7
-rwxr-xr-x. 1 root root 7136 Nov 20 2015 python2.7
lrwxrwxrwx 1 root root 24 Jan 11 10:10 python3 -> /usr/local/bin/python3.6
lrwxrwxrwx. 1 root root 7 Dec 15 2016 python.backup -> python2
#查看最新python版本
[root@qinhan bin]# python -V
Python 3.6.4
#更改yum脚本的python依赖
[root@qinhan bin]# cd /usr/bin
[root@qinhan bin]# view yum
修改#!/usr/bin/python为#!/usr/bin/python2
#修改urlgrabber配置文件
[root@qinhan bin]# view /usr/libexec/urlgrabber-ext-down
修改##! /usr/bin/python 为#! /usr/bin/python2
#查看pip是否可以正常使用
[root@qinhan bin]# pip
-bash: pip: command not found
[root@qinhan bin]# pip3
Usage:
pip <command> [options]
.......
#如果还是报command not found,可以做个软连接如下所示,这个是另外的服务器27.100上的
[root@qinhan /]# cd usr/bin
[root@qinhan bin]# pwd
/usr/bin
[root@qinhan bin]# ll pip*
lrwxrwxrwx 1 root root 27 Jan 10 16:45 pip3 -> /usr/local/python3/bin/pip3
[root@qinhan bin]#
centos 7 安装 python3.6 python3 安装步骤以及pip pip3安装挂载的更多相关文章
- 在windows系统上使用pip命令安装python的第三方库
在windows系统上使用pip命令安装python的第三方库 通过cmd启动命令行后,直接输入pip命令,有时候命令行会提示我们pip不是一个指令,这个时候我们可以通过python的集成开发环境里面 ...
- 001.Pip简介安装使用
一 PIP简介 pip类似RedHat里面的yum,使用PIP安装软件非常便捷快速. 二 PIP下载安装 方式一: [root@localhost ~]# yum install -y epel-re ...
- suse11 安装 python3.6 python3 安装步骤
首先需要去网上下载Python-3.6.4.tgz,libopenssl-devel-0.9.8j-2.1.x86_64.rpm zlib-devel-1.2.7-3.14.x86_64.rpm li ...
- win10 anaconda3 python3.6安装tensorflow keras tensorflow_federated详细步骤及在jupyter notebook运行指定的conda虚拟环境
本文链接:https://blog.csdn.net/weixin_44290661/article/details/1026789071. 安装tensorflow keras tensorflow ...
- Ubuntu16.04下安装python3.6.4详细步骤
记录一下: Ubuntu16.04自带的python版本为python2.7和python3.5,现在想要安装python3.6.4,注意:系统自带的python版本别删除 步骤: # 官网下载安装包 ...
- centos 7系统,解决python3.x 安装后使用yum不能安装的问题(错误:urlgrabber-ext-down | KeyboardInterrupt)
1.在安装python3.xx版本后,通过yum去安装软件会出现问题,目前我遇到的有2种问题 比如显示:urlgrabber-ext-down Downloading packages: File & ...
- CentOS 7 下如何进行Python3的独立安装
一.部署准备工作 部署环境工具检查及安装 1)安装epel-release库,以防db4-devel依赖安装失败 1 yum -y install epel-release 2)安装外部函数库(lib ...
- python3 与 pip3 安装与使用
1. yum -y install openssl* (pip依赖ssl环境) 2.编译安装python3 下载地址:https://www.python.org/ftp/python/ .tgz c ...
- Windows下安装python2和python3双版本
现在大家常用的桌面操作系统有:Windows.Mac OS.ubuntu,其中Mac OS 和 ubuntu上都会自带python.这里我们只介绍下Windows(我用的Win10)环境下的pytho ...
随机推荐
- Day 07 文件的相关操作
文件初始: 文件的三要素: path:文件的路径 mode:r w r+ w+ a encoding: 编码方式 # 打开一个文件的方法 f1 = open('e:\echo.txt', encodi ...
- Java10-java语法基础(九)——java的封装性
Java10-java语法基础(九)——java的封装性 一.Java的三大特性:封装.多态.继承 封装:通过类封装对象的数据成员和成员方法,保证只有可信的类或者对象能够访问这些方法和数据成员,对不可 ...
- 24-算法训练 删除数组零元素-- list的使用
http://lx.lanqiao.cn/problem.page?gpid=T201 算法训练 删除数组零元素 时间限制:1.0s 内存限制:512.0MB 从键盘读入n个整数放入 ...
- python 数据类型 之 利用 dict 模仿 switch语句功能
Python本身并不提供Switch的语法功能,为了能够解决类似switch分支需求的问题,我们可以使用字典代替实现. 解决思路: 利用字典取值的get方法的容错性,处理switch语句中的defau ...
- js阻止a标签默认事件的几种方法
方法/步骤 疑问 打开编辑器,新建html并加入a标签,如图所示,小编想点击a标签时执行pop函数同时禁止a标签的默认的href跳转,该如何阻止呢? 方法一 要阻止a标签跳转,可以改变href ...
- PAT 1012 数字分类 (20)(代码+测试点)
1012 数字分类 (20)(20 分) 给定一系列正整数,请按要求对数字进行分类,并输出以下5个数字: A1 = 能被5整除的数字中所有偶数的和: A2 = 将被5除后余1的数字按给出顺序进行交错求 ...
- fastdfs 上传图片 完整版
1.jsp文件 <%@ page language="java" import="java.util.*" pageEncoding="UTF- ...
- JS 实现 jQuery的$(function(){});
1.浏览器渲染引擎的HTML解析流程 何谓“渲染”,其实就是浏览器把请求到的HTML内容显示出来的过程.渲染引擎首先通过网络获得所请求文档的内容,通常以8K分块的方式完成.下面是渲染引擎在取得内容之后 ...
- GM Tech 2 works with Hummer Yes or No
This is about GM Tech 2 scan tool for Hummer troubleshooting and programming. Can I have a cheap Tec ...
- git回退文件修改
假设git仓库某个文件的提交信息如下: [cxy@localhost-live mate-power-manager]$ git log -n3 SPECS/mate-power-manager.sp ...