无法在Linux上安装Python软件包

时间:2018-01-04 06:54:17

标签: python linux ubuntu-16.04

我是Linux的新手,并且已经启动了我的系统。我特别想安装numpy,darknet或lightnet python包。我尝试按照here

给出的说明进行操作

当我运行以下命令时:

pip install darknetpy

我看到以下错误:

Collecting darknetpy
  Using cached darknetpy-2.0.tar.gz
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-build-5J0HcA/darknetpy/setup.py", line 6, in <module>
        import urllib.request
    ImportError: No module named request

我无法理解这个错误是什么。当我尝试安装numpy包时,我收到以下错误:

Exception:
Traceback (most recent call last):
  File "/home/test/.local/lib/python2.7/site-packages/pip/basecommand.py", line 215, in main
    status = self.run(options, args)
  File "/home/test/.local/lib/python2.7/site-packages/pip/commands/install.py", line 342, in run
    prefix=options.prefix_path,
  File "/home/test/.local/lib/python2.7/site-packages/pip/req/req_set.py", line 784, in install
    **kwargs
  File "/home/test/.local/lib/python2.7/site-packages/pip/req/req_install.py", line 851, in install
    self.move_wheel_files(self.source_dir, root=root, prefix=prefix)
  File "/home/test/.local/lib/python2.7/site-packages/pip/req/req_install.py", line 1064, in move_wheel_files
    isolated=self.isolated,
  File "/home/test/.local/lib/python2.7/site-packages/pip/wheel.py", line 345, in move_wheel_files
    clobber(source, lib_dir, True)
  File "/home/test/.local/lib/python2.7/site-packages/pip/wheel.py", line 316, in clobber
    ensure_dir(destdir)
  File "/home/test/.local/lib/python2.7/site-packages/pip/utils/__init__.py", line 83, in ensure_dir
    os.makedirs(path)
  File "/usr/lib/python2.7/os.py", line 157, in makedirs
    mkdir(name, mode)
OSError: [Errno 13] Permission denied: '/usr/local/lib/python2.7/dist-packages/numpy-1.13.3.dist-info'

请帮助解决此错误。

1 个答案:

答案 0 :(得分:0)

OSError: [Errno 13] Permission denied通常意味着您的调用者没有足够的权限。

看起来您正在尝试使用python2来安装它,因为eyllanesc指出您正在安装的软件包仅由python3支持,因此您必须先安装它。

以下是一些有助于此的链接:

尝试使用sudo再次运行命令,如sudo pip install darknetpy,或作为超级用户(通常使用sudo su获得),然后运行命令。

如果您在尝试pip安装时仍然获得ImportError,请尝试pip安装缺少的模块。