- 临时使用镜像源
- 手动切换镜像源
- 设置多个镜像源
- 查看镜像源
- 生成requirements.txt
- 安装requirements.txt
- linux 环境变量
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple requirements.txt手动切换镜像源
# 全局设置镜像源地址 pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple设置多个镜像源
windows: 在user目录中创建一个pip文件夹,如C:Usersxxpip,在pip文件夹中新建文件pip.ini,内容如下:
linux : vim ~/.pip/pip.conf
[global]
index-url=https://pypi.tuna.tsinghua.edu.cn/simple/
extra-index-url=
http://mirrors.aliyun.com/pypi/simple/
http://pypi.douban.com/simple
http://pypi.mirrors.ustc.edu.cn/simple/
[install]
trusted-host=
pypi.tuna.tsinghua.edu.cn
mirrors.aliyun.com
pypi.douban.com
pypi.mirrors.ustc.edu.cn
查看镜像源
pip config list pip3 config list生成requirements.txt
pip freeze > requirements.txt pip3 freeze > requirements.txt安装requirements.txt
基本安装,会出现有些版本找不到,解决方法是更改镜像源或者降低版本
pip install -r requirements.txt pip3 install -r requirements.txt pip3 install -i -i https://pypi.tuna.tsinghua.edu.cn/simple -r requirements.txt
命令可以跳过安装错误的库,继续安装
while read requirement; do sudo pip2 install $requirement; done < requirements.txtlinux 环境变量
环境变量的分类
Linux 环境变量可以分为用户环境变量与系统环境变量
用户环境变量:~/.bashrc ~/.bash_profile
系统环境变量:/etc/profile /etc/environment /etc/profile.d/*.sh /etc/bashrc
直接vim ~/.bashrc 即可修改



