一条命令在Centos7中换163 yum源、安装python3并与python2共存、使用豆瓣pip源加速

打开一个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

命令行执行:

扫描二维码关注公众号,回复: 5895410 查看本文章
yum -y install python36-devel python36-setuptools && easy_install-3.6 pip && mkdir /root/.pip && mv pip.conf ~/.pip

猜你喜欢

转载自www.cnblogs.com/wangbaojun/p/10709566.html