pip安装时无权限 Consider using the `--user` option or check the permissions.

本文详细阐述了如何在没有root权限的情况下,通过pip install --user Cmake来解决安装模块时遇到的Permission denied错误,强调了使用--user选项的安全性和适用场景。同时提到了Python 2.7的升级建议。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

没权限的安装模块方法
当你不是root用户时,安装模块时报错:

$ pip install Cmake

ERROR: Could not install packages due to an EnvironmentError: [Errno 13] Permission denied: ‘/usr/lib64/python2.7/site-packages/cmake-3.14.4.dist-info’
Consider using the --user option or check the permissions.

因为代表进行全局安装,安装后全局可用

解决办法就是:

$ pip install --user Cmake
DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won’t be maintained after that date. A future version of pip will drop support for Python 2.7.
Collecting Cmake
Using cached https://files.pythonhosted.org/packages/09/bb/0121c0ae40144b99420a1a0ea081d48ac4d77332600896d7e04bf23aa957/cmake-3.14.4-py2-none-manylinux2010_x86_64.whl
Installing collected packages: Cmake
Successfully installed Cmake-3.14.4

添加一个–user,代表仅该用户的安装,安装后仅该用户可用。处于安全考虑,尽量使用该命令进行安装。

记得卸载的时候也要添加 --user

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值