这个问题在这里已经有了答案:
How to install version specified Ruby using apt
(2 个回答)
1年前关闭。
我尝试安装指定版本为 2.5.1 的 Ruby(该版本只是示例),并尝试了以下脚本,但出现如下错误。是否可以使用 apt 安装的版本安装 Ruby,以便我可以处理 Ruby 版本依赖问题?
$ sudo apt update ; sudo apt install ruby-full=2.5.1
Hit:1 http://dl.google.com/linux/chrome/deb stable InRelease
Get:2 https://download.docker.com/linux/ubuntu bionic InRelease [64.4 kB]
Hit:3 http://us.archive.ubuntu.com/ubuntu bionic InRelease
Hit:4 http://ppa.launchpad.net/kelleyk/emacs/ubuntu bionic InRelease
Hit:5 http://security.ubuntu.com/ubuntu bionic-security InRelease
Hit:6 http://us.archive.ubuntu.com/ubuntu bionic-updates InRelease
Hit:7 http://us.archive.ubuntu.com/ubuntu bionic-backports InRelease
Hit:8 http://ppa.launchpad.net/ondrej/php/ubuntu bionic InRelease
Hit:9 http://ppa.launchpad.net/teejee2008/timeshift/ubuntu bionic InRelease
Fetched 64.4 kB in 2s (41.9 kB/s)
Reading package lists... Done
Building dependency tree
Reading state information... Done
40 packages can be upgraded. Run 'apt list --upgradable' to see them.
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Version '2.5.1' for 'ruby-full' was not found```
最佳答案
您可以安装rbenv
这是一个 Ruby 环境,然后您可以在其上安装所需的 Ruby 版本。
引用这个answer
关于ruby - 如何在ubuntu中安装指定版本的Ruby,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64844073/