我无法在我的 ubuntu 中安装 easy_install

我无法在我的 ubuntu 中安装 easy_install

我必须在 ubuntu 中安装 Review board,我尝试了以下命令,但出现了错误

sudo apt-get install python-setuptools.


Reading package lists... Done
Building dependency tree       
Reading state information... Done
Package python-setuptools is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
E: Package python-setuptools has no installation candidate

然后我尝试了下面的命令但是我也收到了错误消息:

apt-get upgrade

E: Could not open lock file /var/lib/dpkg/lock - open (13 Permission denied)
E: Unable to lock the administration directory (/var/lib/dpkg/), are you root?

我该怎么办?请帮帮我!

答案1

Ctrl按+ Alt+打开终端T并输入以下内容:

sudo apt-get update
sudo apt-get upgrade
sudo apt-get install python-setuptools

错误背后的原因
错误1:

Package python-setuptools is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
E: Package python-setuptools has no installation candidate 

当您尝试安装 APT 不了解的软件包时,就会发生这种情况。当您添加软件源然后执行 apt-get update 时,系统 APT 的数据库将使用软件源列表中列出的存储库中的所有软件包进行更新。

然后,当您尝试安装任何软件包时,apt 会检查其数据库中的软件包名称,找到它并检查获取它的存储库的名称。然后它会从该存储库下载软件包。
错误2

  apt-get upgrade

    E: Could not open lock file /var/lib/dpkg/lock - open (13 Permission denied)
    E: Unable to lock the administration directory (/var/lib/dpkg/), are you root?

这就意味着你不是root用户,所以我们用sudoroot身份来执行

答案2

请不要使用easy_install,而是尝试pip一下。

sudo apt-get install python-pip

现在您可以以几乎相同的方式使用它easy_install,但具有更好的包管理。

sudo pip install <pypi-package>

答案3

你找到的第二个问题的答案(无法打开锁定文件)这里

答案4

如果你使用 python3 virualenv 通过 easy_install 安装所需的包,请先尝试通过运行安装 python3-pip

sudo apt install python3-pip

然后通过以下方式安装所需的包

pip install <desired-package>

相关内容