没有根权限无法安装gittle库

2024-05-17 16:49:48 发布

您现在位置:Python中文网/ 问答频道 /正文

我按照这个link安装Gittle库。但当我执行命令时

$ pip install gittle

我得到一个错误:

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

我的Python版本是2.7.6。在


Tags: installpipinbuildloglinkopenrecord
1条回答
网友
1楼 · 发布于 2024-05-17 16:49:48

你需要根权限

由于您正在安装sistem范围的库,因此这些库通常会被放在需要根权限才能写入的目录中(例如/usr/lib下的任何目录)。因此,您需要以root用户身份运行命令:

# pip install gittle

也可以使用sudo:

^{pr2}$

虚拟环境呢?在

更有效的/python方法是使用virtual environments。如果要安装特定于项目的库,这一点尤其正确,而其他项目可能不需要这些库。虚拟环境的另一个经典应用是当你在一台你没有根权限的机器上工作时,比如在大学里。在

设置虚拟环境后,如果将其放置在您具有写入权限的目录中,则可以运行:

$ pip install gittle

在这种情况下安装gittle。在

相关问题 更多 >