首先系统自带的python是python2

我们需要安装一个python3(这里的所有源码包都可以在环境中准备好,这样没有网也可以进行安装)

安装python

1.安装环境

# yum -y install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-develreadline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel sqlite-devel

2.下载包

 wget https://www.python.org/ftp/python/3.6.1/Python-3.6.1.tgz

3.解压包

 tar -zxvf Python-3.6.1.tgz

4.创建安装目录,进入解压后的包,制定安装路径进行安装

mkdir -p /usr/local/python3

cd Python-3.6.1

./configure --prefix=/usr/local/python3
报错
[root@bogon Python-3.6.1]# ./configure --prefix=/usr/local/python3
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking for python3.6... no
checking for python3... no
checking for python... python
checking for --enable-universalsdk... no
checking for --with-universal-archs... no
checking MACHDEP... linux
checking for --without-gcc... no
checking for --with-icc... no
checking for gcc... no
checking for cc... no
checking for cl.exe... no
configure: error: in `/usr/local/src/Python-3.6.1':
configure: error: no acceptable C compiler found in $PATH
See `config.log' for more details

由于本机缺少gcc编译环境

1、通过yum安装gcc编译环境:yum install -y gcc

5.编译安装

make && make install

6.创建软连接

ln -s /usr/local/python3/bin/python3  /usr/bin/python3

ln -s  /usr/local/python3/bin/pip3   /usr/bin/pip3

这样在命令行中输入python代表python2,输入python3代表python3

-----------------------------------------------------------------------------------------------------

./pip3 install --upgrade setuptools pip

python默认的pip版本和setuptools版本比较旧,如果有网,可以在线更新,下面记录一下离线更新

----------------------------------------------------------------------------------------------------

安装pip3

1.首先安装setuptools(安装到python3里,安装完成后可以删除源码包)

wget --no-check-certificate  https://pypi.python.org/packages/source/s/setuptools/setuptools-40.6.2.zip#md5=c607dd118eae682c44ed146367a17e26

unzip  setuptools-40.6.2.zip
cd setuptools-40.6.2
python3 setup.py build
python3 setup.py install

2.安装pip3

wget --no-check-certificate  https://pypi.python.org/packages/source/p/pip/pip-18.1.tar.gz#md5=3a73c4188f8dbad6a1e6f6d44d117eeb

tar -zxvf pip-18.1.tar.gz cd pip-8.0.2 python3 setup.py build python3 setup.py install

3.安装完成之后我们再来看下python的bin目录下都有什么东西吧,发现有pip

创建软连接

ln -s /usr/local/python3/bin/pip  /usr/bin/pip
 

redhat7.3安装python3 pip3的更多相关文章

  1. Centos7 安装python3 pip3

    Centos7 安装python3 pip3 安装python3.6 安装 python36   yum install python36 -y   查看版本 安装完成,查看一下python版本是否正 ...

  2. centos 7 安装python3 & pip3

    1.安装python3 https://www.cnblogs.com/Trees/p/7497482.html 2.解决:python ModuleNotFoundError: No module ...

  3. centos6安装python3.4和pip3

    在安装了epel源的情况下,直接yum就可以安装python3.4 yum install python34 -ypython3 --version 没有自带pip3,从官网安装 wget --no- ...

  4. 编译安装python3.6后pip3无法安装模块问题处理

    编译安装python3.6之后,使用pip3命令安装第三方库效果如图所示: pip is configured with locations that require TLS/SSL, however ...

  5. 环境准备—之—linux下安装python3和pip3

    转自 上海悠悠 https://www.cnblogs.com/yoyoketang/p/10195102.html 前言 centos7 自带有 python,但是却是 python2 版本的 py ...

  6. CentOS 安装Python3、pip3

    https://ehlxr.me/2017/01/07/CentOS-7-%E5%AE%89%E8%A3%85-Python3%E3%80%81pip3/ CentOS 7 默认安装了 Python ...

  7. centos系统下安装python3以及pip3

    首先查看一下系统当前的python版本 python -V 1.安装必要工具 yum-utils 它的功能是管理repository及扩展包的工具yum install yum-utils -y 2. ...

  8. Linux学习5-CentOS安装Python3.6环境和pip3

    前言 centos7 自带有 python,但是却是 python2 版本的 python,如果你想安装个python3怎么办呢? 如果直接删除python2的话,可能会引起其他的问题,因为有些东西是 ...

  9. CentOS7下安装Python3及Pip3并保留Python2

    1. 安装依赖环境 # yum -y install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline- ...

随机推荐

  1. ****** 五十 ******、软设笔记【UML分析和意义】-类图、对象图、状态图、活动图、顺序图、协作图、构件图、部署图,动静态模式

    一.类图(Class Diagram) 描述一组类.接口.协作已经它们之间的图,用来显示系统中各个类的静态结构图. 类之间的关系(relationship) *依赖(dependency) *泛化(g ...

  2. Spring IoC 依赖注入的方法大全 XML配置方式

    Spring 依赖注入 构造方法注入 ①   根据索引注入 <bean name="student" class="cn.bdqn.SpringDI.Student ...

  3. 第27月第27天 https

    1.验证签名 { [self generateRSAKeyPair:kRSA_KEY_SIZE]; NSData *ttDt = [" dataUsingEncoding:NSASCIISt ...

  4. git修改历史记录

     1.git stash2.git rebase 45c2d5c --interactive 3.git stash pop4.git add5.git commit --amend      确认编 ...

  5. vue学习之生命周期和钩子函数

    参考文章:Vue2.0 探索之路——生命周期和钩子函数的一些理解 抛出问题: 我们有时候会在几个钩子函数里做一些事情,那么什么时候做,该在哪个函数里做? 生命周期简介 结合代码看el 和 data以及 ...

  6. git 新建分支

    创建分支   git checkout -b 分支名 推送到远程   git push origin 分支名

  7. sql常用问题(一)

    一.sql要掌握 1.sum select  sum(score) from table 2.group select name, sum(score) from table group by 3.a ...

  8. RPO攻击 & share your mind

    参考文章: https://xz.aliyun.com/t/2220 http://www.thespanner.co.uk/2014/03/21/rpo/ https://www.lorexxar. ...

  9. Django之Bootstrap使用

    首先将bootstrap文件粘贴到static文件夹中,引入分为两部分,一是css文件引入,二是js文件引入. 1.css引入: <!DOCTYPE html> <html lang ...

  10. linux 下为qtcreator 添加排版工具

    1. 下载astyle.   http://sourceforge.net/projects/astyle 这里可以下载最新版本, 目前是3.1  下载文件astyle_3.1_linux.tar.g ...