pip3的PermissionError

时间:2015-01-08 21:00:40

标签: python django ubuntu python-3.x pip

当我尝试使用pip3获取任何内容时,这是错误 我不知道该怎么做

Exception:
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/pip/basecommand.py", line 122, in main
    status = self.run(options, args)
  File "/usr/lib/python3/dist-packages/pip/commands/install.py", line 283, in run
    requirement_set.install(install_options, global_options, root=options.root_path)
  File "/usr/lib/python3/dist-packages/pip/req.py", line 1435, in install
    requirement.install(install_options, global_options, *args, **kwargs)
  File "/usr/lib/python3/dist-packages/pip/req.py", line 671, in install
    self.move_wheel_files(self.source_dir, root=root)
  File "/usr/lib/python3/dist-packages/pip/req.py", line 901, in move_wheel_files
    pycompile=self.pycompile,
  File "/usr/lib/python3/dist-packages/pip/wheel.py", line 206, in move_wheel_files
    clobber(source, lib_dir, True)
  File "/usr/lib/python3/dist-packages/pip/wheel.py", line 193, in clobber
    os.makedirs(destsubdir)
  File "/usr/lib/python3.4/os.py", line 237, in makedirs
    mkdir(name, mode)
PermissionError: [Errno 13] Permission denied: '/usr/local/lib/python3.4/dist-                        packages/Django-1.7.2.dist-info'

Storing debug log for failure in /home/omega/.pip/pip.log

5 个答案:

答案 0 :(得分:45)

只需使用--user选项安装它们,它只为当前用户而不是所有

安装软件包
routing

答案 1 :(得分:14)

您需要使用sudo全局安装或有权写入该文件夹。或者@Alasdair使用virtualenv进行评论是一个更好的选择。

答案 2 :(得分:6)

在安装命令的最后使用--user,以便只为当前用户安装软件包,而不是为所有用户安装。

pip install xxxxxx --user

pip3 install xxxxxx --user

答案 3 :(得分:0)

只需在pip3之前添加sudo即可。与sudo pip3 install <package>

一样

答案 4 :(得分:0)

\set reconnect 1

无需用您的用户名代替--user。