安装python库报错:Consider using the `–user` option or check the permissions.

昨天在服务器上训练ResNet,导包出现了一些小问题:
1)安装tqdm库的时候,出现 Consider using the ‘–user’ option or check the permissions.访问python下的site-package权限不够。添加’–user’即可,再次尝试使用以下命令

pip3 install --user --upgrade tqdm -i https://pypi.tuna.tsinghua.edu.cn/simple

问题解决。
2)使用torch和torchvision的时候出现异常,Invoked with: typing.Union[int, NoneType], None, <function try_ann_to_type.

解决方案:降低torch和torchvision的版本,我原来的版本是torch1.5.1 torchvision0.6.1,之后我使用以下命令:

pip3 uninstall torch
pip3 uninstall torchvision

完成卸载,之后又使用以下命令重新安装了低版本的torch和torchvision

pip3 install torch==1.4.0 torchvision==0.5.0 -i https://pypi.tuna.tsinghua.edu.cn/simple

1、国内使用Pytorch官方网站下载pip库很慢,推荐使用清华源。清华源的链接:
https://pypi.tuna.tsinghua.edu.cn/simple
2、使用pip从清华源安装python库的时候,可以使用以下命令(python2需要将pip3换为pip,加载其他库的时候,直接把torchvision换成需要的库即可,还可以指定版本噢):

pip3 install torchvision==0.5.0 -i https://pypi.tuna.tsinghua.edu.cn/simple

Original: https://blog.csdn.net/Dartao/article/details/124074141
Author: dartao_
Title: 安装python库报错:Consider using the --user option or check the permissions.

原创文章受到原创版权保护。转载请注明出处:https://www.johngo689.com/627763/

转载文章受原作者版权保护。转载请注明原作者出处!

(0)

大家都在看

亲爱的 Coder【最近整理,可免费获取】👉 最新必读书单  | 👏 面试题下载  | 🌎 免费的AI知识星球