python pip 权限_Python:安装pip时权限被拒绝错误

一名学生在Linux 7.2系统上尝试使用get-pip.py安装pip,但遇到了权限问题。首先尝试无sudo安装时遇到`Permission denied`错误,接着尝试使用sudo,却因不在sudoers文件中而失败。目标是最终安装scipy和gensim库。解决方案可能涉及使用virtualenv。

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

I am a student and I am doing project on department computer, system Linux 7.2. Now I am trying to install pip so that I can install python packages using it.

I have downloaded get-pip.py and tried to install via python get-pip.py. It gives me:

Collecting pip

Downloading pip-8.1.1-py2.py3-none-any.whl (1.2MB)

100% |████████████████████████████████| 1.2MB 471kB/s

Collecting wheel

Downloading wheel-0.29.0-py2.py3-none-any.whl (66kB)

100% |████████████████████████████████| 71kB 764kB/s

Installing collected packages: pip, wheel

Exception:

Traceback (most recent call last):

File "/tmp/tmpqybTwL/pip.zip/pip/basecommand.py", line 209, in main

status = self.run(options, args)

File "/tmp/tmpqybTwL/pip.zip/pip/commands/install.py", line 317, in run

prefix=options.prefix_path,

File "/tmp/tmpqybTwL/pip.zip/pip/req/req_set.py", line 732, in install

**kwargs

File "/tmp/tmpqybTwL/pip.zip/pip/req/req_install.py", line 835, in install

self.move_wheel_files(self.source_dir, root=root, prefix=prefix)

File "/tmp/tmpqybTwL/pip.zip/pip/req/req_install.py", line 1030, in move_wheel_files

isolated=self.isolated,

File "/tmp/tmpqybTwL/pip.zip/pip/wheel.py", line 344, in move_wheel_files

clobber(source, lib_dir, True)

File "/tmp/tmpqybTwL/pip.zip/pip/wheel.py", line 315, in clobber

ensure_dir(destdir)

File "/tmp/tmpqybTwL/pip.zip/pip/utils/__init__.py", line 83, in ensure_dir

os.makedirs(path)

File "/usr/lib64/python2.7/os.py", line 157, in makedirs

mkdir(name, mode)

OSError: [Errno 13] Permission denied: '/usr/lib/python2.7/site-packages/pip'

Then, I tried to install using sudo python get-pip.py, however, I got "xxx is not in the sudoers file. This incident will be reported."

So, I was wondering whether I don't have the permission to root and don't have the right to do sudo...but I am not sure about this...

Any suggestion to fix this problem? And in the end, I want to install scipy and gensim.

解决方案

Does the system hand you a virtualenv command?

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值