本文介绍了即使在使用rvm pkg install zlib之后,也无法加载这样的文件 - zlib的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用rvm安装了zlib软件包和ruby 1.9.3,但是每当我尝试安装
gems时,都会说
无法加载这样的文件 - zlib

我用来安装的命令是

  $ rvm安装1.9.3 



 
$ rvm pkg安装zlib

$ rvm重新安装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使用1.9.3

$ gem install heroku
错误:加载命令:install(LoadError)
无法加载此类文件 - zlib
ERROR :执行gem ...(NameError)
未初始化的常量Gem :: Commands :: InstallCommand

所有关于此的帮助主题告诉我只要执行 rvm pkg install zlib
,然后使用重新安装ruby - with-zlib-dir = / home / U sername / .rvm / usr ,但是这个
没有工作。

解决方案

我结束了从apt-get安装zlib,然后重新安装ruby到 not 使用rlm的rvm目录。



这是如何做的:

  $ sudo apt-get install zlib1g-dev 
$ rvm重新安装1.9.3

b

  $ 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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-15 22:04