问题描述
我使用 rvm 安装了 zlib 包和 ruby 1.9.3,但是每当我尝试安装时它说的宝石无法加载此类文件--zlib
我用来安装的命令是
$ rvm install 1.9.3
$ rvm pkg 安装 zlib$ rvm reinstall 1.9.3 --with-readline-dir=/home/username/.rvm/usr --with-iconv-dir=/home/用户名/.rvm/usr--with-zlib-dir=/home/用户名/.rvm/usr--with-openssl-dir=/home/用户名/.rvm/usr$ rvm 使用 1.9.3$ 宝石安装 heroku错误:加载命令:安装(LoadError)无法加载此类文件 -- zlib错误:执行 gem 时...(NameError)未初始化的常量 Gem::Commands::InstallCommand
关于这个主题的所有帮助都告诉我只需执行 rvm pkg install zlib
,然后然后使用 --with-zlib-dir=/home/username/.rvm/usr
重新安装 ruby,但这没用.
我最终从 apt-get 安装了 zlib,然后重新安装 ruby 以 不使用 rvm 目录作为 zlib.
方法如下:
$ sudo apt-get install zlib1g-dev$ rvm 重新安装 1.9.3
正如评论者@chrisfinne 提到的,在基于 CentOS/RedHat 的系统上:
$ sudo yum install zlib-devel$ rvm 重新安装 1.9.3
I installed zlib package and ruby 1.9.3 using rvm, but whenever I try to installgems it sayscannot load such file -- zlib
The commands I used to install are
$ rvm install 1.9.3
$ rvm pkg install zlib $ rvm reinstall 1.9.3 --with-readline-dir=/home/username/.rvm/usr --with-iconv-dir=/home/username/.rvm/usr --with-zlib-dir=/home/username/.rvm/usr --with-openssl-dir=/home/username/.rvm/usr $ rvm use 1.9.3 $ gem install heroku ERROR: Loading command: install (LoadError) cannot load such file -- zlib ERROR: While executing gem ... (NameError) uninitialized constant Gem::Commands::InstallCommand
All the help on this subject tells me to just do rvm pkg install zlib
, andthen reinstall the ruby with --with-zlib-dir=/home/username/.rvm/usr
, but thisdidn't work.
I ended up installing zlib from apt-get and then reinstalling ruby to not use the rvm directory for zlib.
Here's how do:
$ sudo apt-get install zlib1g-dev
$ rvm reinstall 1.9.3
[Edit] As commenter @chrisfinne mentions, on CentOS/RedHat based systems:
$ sudo yum install zlib-devel
$ rvm reinstall 1.9.3
这篇关于即使在使用 rvm pkg install zlib 后也无法加载此类文件 - zlib的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!