Linux Brew无法在Windows 10上运行Ubuntu

内容来源于 Stack Overflow,并遵循CC BY-SA 3.0许可协议进行翻译与使用

  • 回答 (1)
  • 关注 (0)
  • 查看 (487)

我已经在Windows 10上安装了Ubuntu

https://www.microsoft.com/sv-se/p/ubuntu/9nblggh4msv6?rtc=1&activetab=pivot:overviewtab

然后按照此说明设置Linux Brew:

https://bangladroid.wordpress.com/2017/09/26/install-homebrew-in-ubuntu/

一切似乎都有效,因为我测试了以下命令:

$ which brew
/home/xxxxxx/.linuxbrew/bin/brew

但是当我开始使用Brew安装时,我总是遇到以下错误:

Error: cannot load such file -- os/linux/glibc
Please report this bug:
https://github.com/Linuxbrew/linuxbrew/blob/master/share/doc/homebrew/Troubleshooting.md#troubleshooting
    /usr/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:59:in `require'
    /usr/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:59:in `require'
    /home/xxxxxx/.linuxbrew/Library/Taps/homebrew/homebrew-core/Formula/glibc.rb:1:in `load_formula'
    /home/xxxxxx/.linuxbrew/Library/Homebrew/formulary.rb:21:in `module_eval'
    /home/xxxxxx/.linuxbrew/Library/Homebrew/formulary.rb:21:in `load_formula'
    /home/xxxxxx/.linuxbrew/Library/Homebrew/formulary.rb:34:in `load_formula_from_path'
    /home/xxxxxx/.linuxbrew/Library/Homebrew/formulary.rb:83:in `load_file'
    /home/xxxxxx/.linuxbrew/Library/Homebrew/formulary.rb:74:in `klass'
    /home/xxxxxx/.linuxbrew/Library/Homebrew/formulary.rb:70:in `get_formula'
    /home/xxxxxx/.linuxbrew/Library/Homebrew/formulary.rb:207:in `factory'
    /home/xxxxxx/.linuxbrew/Library/Homebrew/formula.rb:1186:in `[]'
    /home/xxxxxx/.linuxbrew/Library/Homebrew/cmd/install.rb:200:in `check_ld_so_symlink'
    /home/xxxxxx/.linuxbrew/Library/Homebrew/cmd/install.rb:213:in `perform_preinstall_checks'
    /home/xxxxxx/.linuxbrew/Library/Homebrew/cmd/install.rb:91:in `install'
    /home/xxxxxx/.linuxbrew/Library/brew.rb:84:in `<main>'

谁知道为什么会这样?是因为Linux Brew无法在Ubuntu Windows上运行吗?

提问于
用户回答回答于

要在GNU / Linux或WSL中安装Linuxbrew,请遵循Homebrew文档中的方法。

  • 更新和升级包: apt update; apt upgrade
  • 安装所需的依赖项: apt install build-essential curl file git
  • 确保shell处于登录模式。或者,跑bash --login
  • 运行安装脚本: sh -c "$(curl -fsSL https://raw.githubusercontent.com/Linuxbrew/install/master/install.sh)"
  • 将Ruby添加到路径: PATH=/home/$USER/.linuxbrew/Homebrew/Library/Homebrew/vendor/portable-ruby/current/bin:$PATH
  • 按Enter继续。
  • ~/.profile通过运行以下命令配置Linuxbrew : echo 'eval $(/home/$USER/.linuxbrew/bin/brew shellenv)' >>~/.profile
  • 将Linuxbrew添加到PATH中: eval $(/home/$USER/.linuxbrew/bin/brew shellenv)
  • 检查环境变量: echo $PATH
  • 运行brew update --force以完成安装。
  • 尝试安装包: brew install hello

扫码关注云+社区

领取腾讯云代金券