无法使用pip安装软件包 - 权限被拒绝

时间:2016-04-19 10:39:38

标签: python linux ubuntu pip

我在尝试安装'统计数据时遇到问题'在ubuntu上用pip打包。 运行Ubuntu 14.04.3 LTS(GNU / Linux 3.14.17-执行x86_64)

  

pip install statistics

我得到了

  

错误:无法创建' /usr/local/lib/python2.7/dist-packages/statistics':权限被拒绝

完整输出是:

TEMPHOSTNAME:~$ pip install statistics
Downloading/unpacking statistics
Downloading statistics-1.0.3.5.tar.gz
Running setup.py (path:/tmp/pip_build_tester/statistics/setup.py) egg_info for package statistics

Downloading/unpacking docutils>=0.3 (from statistics)
Downloading docutils-0.12.tar.gz (1.6MB): 1.6MB downloaded
Running setup.py (path:/tmp/pip_build_tester/docutils/setup.py) egg_info for package docutils

warning: no files found matching 'MANIFEST'
warning: no files found matching '*' under directory 'extras'
warning: no previously-included files matching '.cvsignore' found under  directory '*'
warning: no previously-included files matching '*.pyc' found under directory '*'
warning: no previously-included files matching '*~' found under directory '*'
warning: no previously-included files matching '.DS_Store' found under directory '*'
Installing collected packages: statistics, docutils
Running setup.py install for statistics
error: could not create '/usr/local/lib/python2.7/dist-packages/statistics': Permission denied
Complete output from command /usr/bin/python -c "import setuptools,    tokenize;__file__='/tmp/pip_build_tester/statistics/setup.py';exec(compile(getat tr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-DT9Slu-record/install-record.txt --single- version-externally-managed --compile:
running install

running build

running build_py

creating build

creating build/lib.linux-x86_64-2.7

creating build/lib.linux-x86_64-2.7/statistics

copying statistics/__init__.py -> build/lib.linux-x86_64-2.7/statistics

running install_lib

creating /usr/local/lib/python2.7/dist-packages/statistics

error: could not create '/usr/local/lib/python2.7/dist-packages/statistics':   Permission denied

----------------------------------------
Cleaning up...
Command /usr/bin/python -c "import setuptools,  tokenize;__file__='/tmp/pip_build_tester/statistics/setup.py';exec(compile(getat tr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-DT9Slu-record/install-record.txt --single-version-externally-managed --compile failed with error code 1 in /tmp/pip_build_tester/statistics
Storing debug log for failure in /home/tester/.pip/pip.log

尝试使用' sudo'

  

sudo pip install statistics

TEMPHOSTNAME:~$ sudo pip install statistics
Downloading/unpacking statistics
Cannot fetch index base URL https://pypi.python.org/simple/
Could not find any downloads that satisfy the requirement statistics
Cleaning up...
No distributions at all found for statistics
Storing debug log for failure in /home/tester/.pip/pip.log

有什么想法吗?

提前致谢,

  

编辑:   Soulution:
  我明白了。似乎su env中缺少http-proxy配置,所以我设置了这个代理,最后安装完成了。无论如何,谢谢大家。

0 个答案:

没有答案