栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 系统运维 > 运维 > Linux

pip install requirements.txt时跳过失败项继续安装,设置多个镜像源,设置临时镜像源,查看镜像源

Linux 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

pip install requirements.txt时跳过失败项继续安装,设置多个镜像源,设置临时镜像源,查看镜像源

这里写目录标题
      • 临时使用镜像源
      • 手动切换镜像源
      • 设置多个镜像源
      • 查看镜像源
      • 生成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.txt
linux 环境变量

环境变量的分类
Linux 环境变量可以分为用户环境变量与系统环境变量
用户环境变量:~/.bashrc ~/.bash_profile
系统环境变量:/etc/profile /etc/environment /etc/profile.d/*.sh /etc/bashrc
直接vim ~/.bashrc 即可修改

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/964692.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号