【问题标题】:Errno 13 when installing python package安装 python 包时出现 Errno 13
【发布时间】:2023-04-10 14:27:02
【问题描述】:

我对编程很陌生,我刚刚将 Ubuntu 下载到我的笔记本电脑上。 我遇到的问题是,当我尝试从终端安装 python 包制表 (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

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

【问题讨论】:

  • 使用sudo pip install tabulate
  • pip install --user tabulate
  • 哇,谢谢,这比我想象的要容易
  • 使用 virtualenv 来避免 sudo 权限。参考:virtualenv.pypa.io/en/latest/userguide.html
  • @JasonEstibeiro 请在下面的“答案”中添加您的答案,以便为后代留下正确答案的历史:)

标签: python linux ubuntu terminal


【解决方案1】:

@JRodDynamite 回答:使用

sudo pip install tabulate

【讨论】:

  • 不要从 cmets 复制粘贴!
  • 请不要从 cmets 复制。
  • 然后请在评论中回答您的人将其作为答案,这样他也可以从他的回答中获得 +reputation。
  • @hedgehog - 没关系。让他将其发布为答案。将此视为我的欢迎礼物。欢迎来到 SO! :)
猜你喜欢
  • 1970-01-01
  • 2020-03-22
  • 2019-03-27
  • 1970-01-01
  • 2020-10-27
  • 1970-01-01
  • 1970-01-01
  • 2019-12-12
  • 2019-04-20
相关资源
最近更新 更多