安装pip时权限被拒绝错误

安装pip时权限被拒绝错误

本文介绍了Python:安装pip时权限被拒绝错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是一名学生,我正在系统Linux 7.2的部门计算机上进行项目.现在,我正在尝试安装pip,以便可以使用它安装python软件包.

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.

我已经下载了get-pip.py,并尝试通过python get-pip.py安装.它给了我:

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'

然后,我尝试使用sudo python get-pip.py进行安装,但是,我得到了"xxx is not in the sudoers file. This incident will be reported."

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."

所以,我想知道我是否没有root权限,也没有执行sudo的权利...但是我对此不确定...

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...

是否有解决此问题的建议?最后,我要安装scipygensim.

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

推荐答案

系统是否向您发送virtualenv命令?

Does the system hand you a virtualenv command?

然后,您应该阅读有关virtualenvs的内容.无论如何都可以派上用场.

Then you should read about virtualenvs. Comes in handy anyhow.

否则,您可以使用方法贾斯珀·范·登·博世(Jasper van den Bosch)

这篇关于Python:安装pip时权限被拒绝错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-23 11:21