安装 dlib 时权限被拒绝

安装 dlib 时权限被拒绝

我尝试使用以下命令安装 dlib:

pip install dlib

看起来一切正常,但后来我收到一条错误消息。如下所示:

Collecting dlib
  Using cached dlib-19.7.0.tar.gz
Building wheels for collected packages: dlib
  Running setup.py bdist_wheel for dlib ... done
  Stored in directory: /home/andrew/.cache/pip/wheels/17/1f/5d/187f5a9fc1d63527e97fa08f5f43315e72a7b7c2ebc54e02e3
Successfully built dlib
Installing collected packages: dlib
Exception:
Traceback (most recent call last):
  File "/home/andrew/.local/lib/python2.7/site-packages/pip/basecommand.py", line 215, in main
    status = self.run(options, args)
  File "/home/andrew/.local/lib/python2.7/site-packages/pip/commands/install.py", line 342, in run
    prefix=options.prefix_path,
  File "/home/andrew/.local/lib/python2.7/site-packages/pip/req/req_set.py", line 784, in install
**kwargs
  File "/home/andrew/.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/andrew/.local/lib/python2.7/site-packages/pip/req/req_install.py", line 1064, in move_wheel_files
    isolated=self.isolated,
  File "/home/andrew/.local/lib/python2.7/site-packages/pip/wheel.py", line 345, in move_wheel_files
    clobber(source, lib_dir, True)
  File "/home/andrew/.local/lib/python2.7/site-packages/pip/wheel.py", line 316, in clobber
    ensure_dir(destdir)
  File "/home/andrew/.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/dlib'

我不确定为什么它显示权限被拒绝。有人知道如何解决这个错误吗?

答案1

使用

sudo pip install dlib

并确保你已经在 ubuntu 中安装了 cmake 并配置了

相关内容