美文网首页
gem install 时报错,no such file to

gem install 时报错,no such file to

作者: 依然饭太稀 | 来源:发表于2017-04-19 16:34 被阅读642次

通过gem 安装redis库时,报告

#gem install redis

ERROR:  Loading command: install (LoadError)

no such file to load -- zlib

ERROR:  While executing gem ... (NameError)

uninitialized constant Gem::Commands::InstallCommand

解决办法是:

首先在/usr/local/src下执行

yum install zlib*

然后进入ruby源码文件夹

安装ruby自身提供的zlib包

#cd ext/zlib

#ruby ./extconf.rb

#make

#make install

如果这里提示:

make: *** No rule to make target `/include/ruby.h', needed by `zlib.o'.  Stop.

打开ext/zlib/Makefile文件,找到下面一行:

zlib.o: $(top_srcdir)/include/ruby.h

改成:

zlib.o: ../../include/ruby.h

然后再在当前目录(ext/zlib)下执行make&make install即可。

相关文章

网友评论

      本文标题:gem install 时报错,no such file to

      本文链接:https://www.haomeiwen.com/subject/umrhzttx.html