没有root权限无法安装gittle库 [英] Unable to install gittle library without root privileges

查看:124
本文介绍了没有root权限无法安装gittle库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遵循了这个链接来安装Gittle库.但是当我运行命令时

I followed this link to install Gittle library. But when I run a command

$ pip install gittle

我得到一个错误:

命令/usr/bin/python -c导入setuptools, 标记化; __ file __ ='/tmp/pip_build_victor /gittle/setup.py';exec(compile(getattr(tokenize,'open', 打开)(__ file __).read().replace('\ r \ n','\ n'),__file__,'exec')) 安装--record/tmp/pip-aoyPEt-record/install-record.txt --single-version-externally-managed-编译失败,错误代码为/tmp/pip_build_victor/gittle,在以下位置存储调试日志: /home/victor/.pip/pip.log

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.

推荐答案

您需要root特权

由于要安装系统级的库,因此通常会将它们放置在需要具有root用户特权才能进行写入的目录中(例如,/usr/lib下的任何内容).因此,您需要以root用户身份运行命令:

You Need Root Privileges

Since you are installing sistem-wide libraries, these usually will be placed in directories which need root privileges for writing in them (for example anything under /usr/lib). Hence you need to either run the command as root:

# pip install gittle

或者您可以使用sudo:

Or you can use sudo:

$ sudo pip install gittle

虚拟环境如何?

更有效/Python化的方法是使用虚拟环境.如果要安装特定于项目的库,则尤其如此,而其他项目很可能不需要该库.虚拟环境的另一种经典应用是在没有root特权的计算机上工作,例如在大学里.

What About Virtual Environments?

The more efficient/pythonic way to go about this would be using virtual environments. This is especially true if you are installing project-specific libraries, which will most probably not be required by other projects. Another classical application of virtual environments is when you are working on a machine on which you don't have root privileges, say at university for example.

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

Once you set up a virtual environment, if you place it in a directory on which you have writing rights, you can run:

$ pip install gittle

在这种情况下安装gittle.

这篇关于没有root权限无法安装gittle库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆