1. 程式人生 > >一條命令在Centos7中換163 yum源、安裝python3並與python2共存、使用豆瓣pip源加速

一條命令在Centos7中換163 yum源、安裝python3並與python2共存、使用豆瓣pip源加速

mkdir config 執行 too rmi sqlit curl nss term

打開一個Terminal:

換yum源:

mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup && curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.163.com/.help/CentOS7-Base-163.repo && yum makecache

安裝python3

yum -y install epel-release zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gcc
make openldap-devel && curl -O https://www.python.org/ftp/python/3.6.6/Python-3.6.6.tar.xz && tar -xvJf Python-3.6.6.tar.xz && cd Python-3.6.6 && ./configure prefix=/usr/local/python3 && make && make install && ln -s /usr/local/python3/bin/python3 /usr/bin/python3.6 && ln -s /usr/local/python3/bin/python3 /usr/bin/python3 && cd .. && rm -rf Python-3.6.*

使用豆瓣pip源加速:

創建pip.conf

內容如下:

[global]
timeout = 60
index-url = http://pypi.douban.com/simple
trusted-host = pypi.douban.com

命令行執行:

yum -y install python36-devel python36-setuptools && easy_install-3.6 pip && mkdir /root/.pip && mv pip.conf ~/.pip

一條命令在Centos7中換163 yum源、安裝python3並與python2共存、使用豆瓣pip源加速