python - 安装python包时出现Errno 13

标签 python linux ubuntu terminal

我是编程新手,我刚刚将 Ubuntu 下载到我的笔记本电脑上。 我遇到的问题是,当我尝试从终端安装 python 包 tabulate ( https://pypi.python.org/pypi/tabulate ) 时,它显示错误,告诉我我没有这样做的权限。

    kai@kai-HP-Notebook:~$ pip install tabulate
Downloading/unpacking tabulate
  Downloading tabulate-0.7.5.tar.gz
  Running setup.py (path:/tmp/pip_build_kai/tabulate/setup.py) egg_info for package tabulate

Installing collected packages: tabulate
  Running setup.py install for tabulate
    error: [Errno 13] Permission denied: '/usr/local/lib/python2.7/dist-packages/tabulate.py'
    Complete output from command /usr/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip_build_kai/tabulate/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-If5xKf-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

copying tabulate.py -> build/lib.linux-x86_64-2.7

running install_lib

copying build/lib.linux-x86_64-2.7/tabulate.py -> /usr/local/lib/python2.7/dist-packages

error: [Errno 13] Permission denied: '/usr/local/lib/python2.7/dist-packages/tabulate.py'

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

我做错了什么?我敢肯定这是一个很容易解决的问题。

最佳答案

@JRodDynamite 回答:使用

sudo pip install tabulate

关于python - 安装python包时出现Errno 13,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36836780/

相关文章:

python - 如何对表中的一列 Django 元素进行排序?

python - 涉及列表的格式问题

python - 从多个 url 的 csv 列表打印 JSON 数据

ubuntu - 在 wsl 上安装 doxygen 无法找到 Iconv(缺少 : ICONV_COMPILES)

linux - 在 Dockerfile 中运行 chown 什么都不做

python - 我们如何获得来自特定国家/地区的推文

ruby - 如何获取另一个unix文件夹中文件的文件路径?

php - UTF-8贯穿始终

php - 如何在 CentOS 7/RHEL 7 上安装 Sublime 3?

ubuntu - 无法打开 hadoop 本地主机 :50070