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

问题描述

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

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

$ pip install gittle

我得到一个错误:

我的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库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-02 18:55