pip install -r requirements.txt遇到的一堆问题即解决办法

一、ImportError: cannot import name DependencyWarning

(1)问题描述
通过ssh远程登录服务器(Ubuntu 18.04)后,输入命令“pip install -r requirements.txt”报错“ImportError: cannot import name DependencyWarning

(2)解决办法

sudo pip install -r requirements.txt

二、WARNING: The directory ‘/home/xxx/.cache/pip’ or its parent directory is not owned or is not writable by the current user.

(1)问题描述
采用sudo方式导致的WARNING,根据反馈的提示“The cache has been disabled. Check the permissions and owner of that directory. If executing pip with sudo, you may want sudo’s -H flag.”,将/.cache/pip赋予给root用户

xxx指username
sudo是给与暂时的root权限,chown是改变文件的归属者;-r指递归(不仅把pip文件夹赋予给root, 其子文件夹以及文件也赋予给root)

(2)解决办法

sudo chown -R root /home/$USERNAME/.cache/pip/

将$USERNAME换成自己取的名字

三、ERROR: Could not find a version that satisfies the requirement futures==3.2.0
在这里插入图片描述
(1)问题描述
在按照“requirements.txt”搭建环境的过程中产生的ERROR。

(2)解决办法(从stackflow获得)

curl https://bootstrap.pypa.io/get-pip.py | python

①Note that upgrading pip via pip install --upgrade pip will also not upgrade it correctly. It is a chicken-and-egg issue(CSDN上有些答案便是pip install --upgrade pip,没法解决问题)
②Note: You may need to use sudo python above if not in a virtual environment.(如果不是在虚拟机中,要使用sudo python!!!)

四、ERROR: Could not find a version that satisfies the requirement pkg-resources==0.0.0
在这里插入图片描述
(1)问题描述
在按照“requirements.txt”搭建环境的过程中产生的ERROR。

(2)解决办法(从stackflow获得)
把requirements.txt中的"pkg-resources==0.0.0"删掉掉;
在这里插入图片描述

  • 3
    点赞
  • 19
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值