无法使用apt

编程入门 行业动态 更新时间:2024-10-28 10:25:10
本文介绍了无法使用apt-get在Ubuntu 14.04上安装bazel的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我尝试了以下命令,但是每次都会出现相同的错误:

I tried following commands but keep getting same error everytime:

echo "deb [arch=amd64] storage.googleapis/bazel-apt stable jdk1.8" | sudo tee /etc/apt/sources.list.d/bazel.list curl bazel.build/bazel-release.pub.gpg | sudo apt-key add - sudo apt-get update

但是命令sudo apt-get install bazel每次都会给出相同的错误:

But the command sudo apt-get install bazel gives same error every time:

Reading package lists... Done Building dependency tree Reading state information... Done E: Unable to locate package bazel

我将如何安装bazel软件包?

How would I be able to install the bazel package?

推荐答案

实际上存在一个类似问题:

askubuntu/questions/378558/在尝试使用apt安装软件包时无法定位软件包

我尝试了投票得最好的答案,发现没有打包包.

I tried the answer voted most, and found that there wasn't a bazel package.

所以我去了bazel的官方网站:

So I went to the official website of bazel:

docs.bazel.build/versions/master/install -ubuntu.html

我尝试了推荐的方法使用Bazel自定义APT存储库",但陷入了第一步,在Google中发现了许多类似的问题,但是没有帮助.

I tried the recommended way,"Using Bazel custom APT repository", but got stuck in the 1st step, and I found many similar problems in Google, but nothing helps.

所以我尝试了第二种方式,使用二进制安装程序安装",幸好它能起作用!

So I tried the 2nd way,"Install using binary installer", thankfully it works!

这是我从中复制的步骤(稍作改动):

Here are the steps I copied from it(a little changed):

  • 安装必需的软件包
  • Install required packages

    sudo apt-get install pkg-config zip g ++ zlib1g-dev解​​压缩python

    sudo apt-get install pkg-config zip g++ zlib1g-dev unzip python

  • 下载Bazel

  • Download Bazel

    转到Bazel的 GitHub版本页面.

    下载二进制安装程序bazel-0.7.0-installer-linux-x86_64.sh(我得到的最新版本).此安装程序包含Bazel二进制文件和必需的JDK,即使已安装JDK也可以使用.

    Download the binary installer bazel-0.7.0-installer-linux-x86_64.sh(the latest version I got). This installer contains the Bazel binary and the required JDK, and can be used even if JDK is already installed.

    请注意,还存在bazel-0.7.0-without-jdk-installer-linux-x86_64.sh.它是不带有嵌入式JDK 8的版本.仅在已经安装JDK 8的情况下,才使用此安装程序.

    Note that bazel-0.7.0-without-jdk-installer-linux-x86_64.sh also exists. It is a version without embedded JDK 8. Only use this installer if you already have JDK 8 installed.

    运行安装程序

    chmod + x bazel-0.7.0-installer-linux-x86_64.sh

    chmod +x bazel-0.7.0-installer-linux-x86_64.sh

    ./bazel-0.7.0-installer-linux-x86_64.sh --user

    ./bazel-0.7.0-installer-linux-x86_64.sh --user

    -user 标志将Bazel安装到系统上的 $ HOME/bin 目录,并将 .bazelrc 路径设置为 $ HOME/.bazelrc .使用-help 命令查看其他安装选项.

    The --user flag installs Bazel to the $HOME/bin directory on your system and sets the .bazelrc path to $HOME/.bazelrc. Use the --help command to see additional installation options.

    设置您的环境

    如果使用上面的-user 标志运行Bazel安装程序,则Bazel可执行文件将安装在 $ HOME/bin 目录中.将此目录添加到默认路径是一个好主意,如下所示:

    If you ran the Bazel installer with the --user flag as above, the Bazel executable is installed in your $HOME/bin directory. It's a good idea to add this directory to your default paths, as follows:

    export PATH ="$ PATH:$ HOME/bin"

    export PATH="$PATH:$HOME/bin"

    您还可以将此命令添加到您的〜/.bashrc 文件中.

    You can also add this command to your ~/.bashrc file.

  • 更多推荐

    无法使用apt

    本文发布于:2023-07-04 10:59:04,感谢您对本站的认可!
    本文链接:https://www.elefans.com/category/jswz/34/1023487.html
    版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
    本文标签:apt

    发布评论

    评论列表 (有 0 条评论)
    草根站长

    >www.elefans.com

    编程频道|电子爱好者 - 技术资讯及电子产品介绍!