一、安装python
1、下载python,地址:
下载安装包:https://www.python.org/ftp/python
2、安装python
解压tgz文件,在命令端输入:
./configure --prefix=/usr/local/python36
make && make install
二、安装pip
sudo apt-get install python3-pip
sudo pip3 install --upgrade pip
切换pip源
根目录创建.pip文件:mddir ~/.pip
创建文件pip.conf:vim .pip/pip.conf
点击"i"键,进入编辑模式,复制信息:
[global]
index-url = https://pypi.tuna.tsinghua.edu.cn/simple
trusted-host = pypi.tuna.tsinghua.edu.cn
点击:“ESC”切换到命令行模式,输入“:wq”保存离开。
这个更换的是清华的源,清华的源5分钟同步官网一次,建议使用。
清华大学 https://pypi.tuna.tsinghua.edu.cn/simple/
阿里云 http://mirrors.aliyun.com/pypi/simple/
中国科技大学 https://pypi.mirrors.ustc.edu.cn/simple/
豆瓣(douban) http://pypi.douban.com/simple/
中国科学技术大学 http://pypi.mirrors.ustc.edu.cn/simple/