我正在尝试通过 pip 安装软件包。以下是一些信息:
OS = Ubuntu 15.10
python --version = 2.7.10
pip --version = pip 8.0.2 from /usr/local/lib/python2.7/dist-packages (python 2.7)
到目前为止,我已经尝试使用 pip 命令安装 scikit-learn、pyqrcode 和 numpy,但均未成功安装。例如使用 numpy:
pip install numpy
输出为:
Collecting numpy
Downloading numpy-1.10.4.tar.gz (4.1MB)
100% |████████████████████████████████| 4.1MB 137kB/s
Building wheels for collected packages: numpy
Running setup.py bdist_wheel for numpy ... done
Stored in directory: /home/diego/.cache/pip/wheels/66/f5 /d7/f6ddd78b61037fcb51a3e32c9cd276e292343cdd62d5384efd
Successfully built numpy
Installing collected packages: numpy
Exception:
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/pip/basecommand.py", line 209, in main
status = self.run(options, args)
File "/usr/local/lib/python2.7/dist-packages/pip/commands/install.py", line 317, in run
prefix=options.prefix_path,
File "/usr/local/lib/python2.7/dist-packages/pip/req/req_set.py", line 731, in install
**kwargs
File "/usr/local/lib/python2.7/dist-packages/pip/req/req_install.py", line 841, in install
self.move_wheel_files(self.source_dir, root=root, prefix=prefix)
File "/usr/local/lib/python2.7/dist-packages/pip/req/req_install.py", line 1040, in move_wheel_files
isolated=self.isolated,
File "/usr/local/lib/python2.7/dist-packages/pip/wheel.py", line 343, in move_wheel_files
clobber(source, lib_dir, True)
File "/usr/local/lib/python2.7/dist-packages/pip/wheel.py", line 314, in clobber
ensure_dir(destdir)
File "/usr/local/lib/python2.7/dist-packages/pip/utils/__init__.py", line 82, 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.10.4.dist-info'
有什么帮助吗?谢谢
答案1
尝试一下sudo pip install numpy
- 您可以在输出的底部看到“权限被拒绝”,这告诉您您的登录名没有权限执行此操作,因此采用 sudo 额外权限可以修复此问题。