新手问题 安装 ruby 环境问题

waitingaminute · 2014年09月05日 · 最后由 waitingaminute 回复于 2014年09月06日 · 3919 次阅读

window 系统,ruby1.9.3,安装 mysql2 安装不上,总报错,有遇到同样问题的吗。

Gem files will remain installed in D:/Ruby193/lib/ruby/gems/1.9.1/gems/mysql2-0.3.16 for inspection.Results logged to D:/Ruby193/lib/ruby/gems/1.9.1/gems/mysql2-0.3.16/ext/mysql2/gem_make.out
An error occurred while installing mysql2 (0.3.16), and Bundler cannot continue.
Make sure that `gem install mysql2 -v '0.3.16'` succeeds before bundling.
D:\devKit>gem install mysql2 -v '0.3.16'
WARNING:  Error fetching data: Errno::ETIMEDOUT: A connection attempt failed bec
ause the connected party did not properly respond after a period of time, or est
ablished connection failed because connected host has failed to respond. - conne
ct(2) (http://rubygems.org/specs.4.8.gz)
Temporarily enhancing PATH to include DevKit...
Building native extensions.  This could take a while...
ERROR:  Error installing mysql2:
        ERROR: Failed to build gem native extension.

        D:/Ruby193/bin/ruby.exe extconf.rb
checking for ruby/thread.h... no
。。。。。。。。。。。。。
Gem files will remain installed in D:/Ruby193/lib/ruby/gems/1.9.1/gems/mysql2-0.
3.16 for inspection.
Results logged to D:/Ruby193/lib/ruby/gems/1.9.1/gems/mysql2-0.3.16/ext/mysql2/g
em_make.out

你把 GEM 的源换成淘宝的源试试看 把安装命令换成 gem install mysql2 -- --with-mysql-dir=mysql 安装路径

#1 楼 @rickylee “把 GEM 的源换成淘宝的”这个什么意思,没听过,那个命令我也试过,不管用

是我没说清楚,是更换 RubyGems 镜像 gem sources --remove http://rubygems.org/ gem sources -a http://ruby.taobao.org/ gem sources -l 这是 RubyGems 镜像的更换命令 你在 windows 上安装了 mysql 的话就可以用 gem install mysql2 -- --with-mysql-dir=mysql 安装路径 http://rubydoc.info/gems/mysql2/0.3.16/frames 这是 mysql2 的文档,你仔细看下文档,我当时是用那个命令解决的

#3 楼 @rickylee 没管用,不过谢谢你耐心的帮助,我重新安一遍,mysql 版本换低点的再试试

#4 楼 @waitingaminute

  • connect(2) (http://rubygems.org/specs.4.8.gz) 这行的错误提示是说没有链接上 RubyGems 镜像,所以先换成 taobao 的镜像试试。我用的那个命令和文档里的有点不一样,我是直接用我本机的 mysql 安装路径的,因为按照文档里的那个 C 库的路径编译的话,可能会造成 mysql 的版本不一致的问题,你到时注意些!

windoes 环境啊。windows 环境需要各种编译环境啊什么的 很坑的。建议楼主如果想搞的话可以先用 sqlite3 或者直接干脆把系统换成 linux 的好了。

#7 楼 @hging 换成 linux 肯定不可能啊,我就这一台电脑啊,换成 linux 不用干别的了。。。。。。。。

#8 楼 @waitingaminute 双系统,我是 ubuntu12.04+windows,开发全部移步 linux 了。linux 下开发的生态很好,据说 mac 更好,硅谷都是用水果。

#9 楼 @flowerwrong 我这电脑不行了,用了好几年的笔记本,带不动双系统了,一个系统还老卡死呢,囧啊

提示明显告诉你连接不上。 用淘宝源。

#8 楼 @waitingaminute 买个 VPS。哈哈哈

#12 楼 @hging 额。。。。。。。。。我去年还在自己电脑上安装过,很顺利的,今天就按不上了,哎

终于弄好了,我参考的是 stackoverflow 上这个网址,用他的软件和步骤安上了,之后调一调可以了,网址http://stackoverflow.com/questions/15604058/error-cannot-load-such-file-mysql2-2-0-mysql2-loaderror-on-windows-xp,希望对以后遇到同样问题的朋友有所帮助

需要 登录 后方可回复, 如果你还没有账号请 注册新账号