linux centos7.3 安装python3.7

 

首先;

um -y install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel

yum install libffi-devel -y

下载Python3

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

安装python3

mkdir -p /usr/local/python3

解压编译安装

  1. tar -zxvf Python-3.7.0.tgz

  2. cd Python-3.7.0

  3. ./configure --prefix=/usr/local/python3

  4. make && make install

建立python3的软链

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

将/usr/local/python3/bin加入PATH

PATH=$PATH:$HOME/bin:/usr/local/python3/bin

 

linux python3换pip 源

1)检查pip.conf文件是否存在
    >> cd ~
    >> mkdir .pip
    >> ls ~/.pip
2)直接编辑pip.conf
    sudo vim ~/.pip/pip.conf

[global]

index-url = http://mirrors.aliyun.com/pypi/simple/

[install]

trusted-host = mirrors.aliyun.com

pip国内的一些镜像

  阿里云 https://mirrors.aliyun.com/pypi/simple/
  中国科技大学 https://pypi.mirrors.ustc.edu.cn/simple/
  豆瓣(douban) http://pypi.douban.com/simple/
  清华大学 https://pypi.tuna.tsinghua.edu.cn/simple/
  中国科学技术大学 http://pypi.mirrors.ustc.edu.cn/simple/

 

你可能感兴趣的:(python)