新手问题 win7 ruby 自宫指南

i5ting · 2013年11月20日 · 最后由 yangjie6020 回复于 2013年11月27日 · 6774 次阅读

安装 ruby 2.0

rubyinstaller-2.0.0-p247-x64.exe

安装 devkit

DevKit-mingw64-64-4.7.2-20130224-1432-sfx.exe

再 cmd 里切换到 D:\dev

初始化 devkit

ruby dk.rb init

修改 config.yml 里增加 ruby sdk 路径

安装 devkit

ruby dk.rb -f install

查看结果

ruby dk.rb review

查看一下结果即可

安装 mysql 2

不一定要 mysql server 版本的,只要有 mysql-connector 即可

C:\Users\Administrator>gem install mysql2 --platform=ruby -- '--with-mysql-lib="D:\Ruby200-x64\mysql-connector-c-6.1.2-winx64\lib"  --with-mysql-include="D:\Ruby200-x64\mysql-connector-c-6.1.2-winx64\include"

Temporarily enhancing PATH to include DevKit...
Building native extensions with: '--with-mysql-lib="D:\Ruby200-x64\mysql-connect
or-c-6.1.2-winx64\lib"  --with-mysql-include="D:\Ruby200-x64\mysql-connector-c-6
.1.2-winx64\include"'
This could take a while...
Successfully installed mysql2-0.3.14
Parsing documentation for mysql2-0.3.14
unable to convert "\x90" from ASCII-8BIT to UTF-8 for lib/mysql2/mysql2.so, skip
ping
Installing ri documentation for mysql2-0.3.14
1 gem installed

最后要把 D:\Ruby200-x64\mysql-connect or-c-6.1.2-winx64\lib\libmysql.dll 放到 Ruby200-x64\bin

Could not find gem 'sdoc (>= 0) x86-mingw32'

gem install sdoc

bundle install 找不到 https 证书

Could not verify the SSL certificate for https://rubygems.org/. There is a chance you are experiencing a man-in-the-middle attack, but most likely your system doesn't have the CA certificates needed for verification. For information about OpenSSL certificates, see bit.ly/ssl-certs. To connect without using SSL, edit your Gemfile sources and change 'https' to 'http'.

http://ruby.taobao.org也是一样的

为啥不让 ssl 待查原因

继续

runnerw.exe D:\Ruby200-x64\bin\ruby.exe -e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift) D:/rubyproject/pp/bin/rails server -b 127.0.0.1 -p 3000 -e development
D:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/mysql2-0.3.14/lib/mysql2/mysql2.so: [BUG] Segmentation fault
ruby 2.0.0p247 (2013-06-27) [x64-mingw32]

-- Control frame information -----------------------------------------------
c:0020 p:-9664014 s:0068 e:000067 TOP    [FINISH]
c:0019 p:---- s:0066 e:000065 CFUNC  :require
c:0018 p:0083 s:0062 e:000061 TOP    D:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/mysql2-0.3.14/lib/mysql2.rb:8 [FINISH]

貌似在装 sqlite 这个 gem 的时候也需要指定 sqlite 所在的目录

PS: 2.0.0 花费的功夫太多我的环境还是在 1.9.3

#1 楼 @ywjno win7 还真是挺麻烦的,还是 mac 好啊

#1 楼 @ywjno HOHO,所以我文章标题上用自宫二字,哈哈

#2 楼 @i5ting 其实我想说的是,win 下用 1.9.3 版本的 ruby 挺好的。。。

#4 楼 @ywjno 嘻嘻,我是第一次玩 win,所以用了 2,有啥好经验,还请不吝赐教啊

没有 SSL 证书可以下一个 cert.pem,设置一下环境变量解决,还有标题还是建议优化下 SEO,让更多人自宫。。。

神功炼成了吗?

如不自宫,亦可成功。

最后一个 segfault, 把 mysql2 的 bin 目录放到路径中试试?

#10 楼 @i5ting er.. 说错了,mysql 的 bin 目录

我一直都是 railsintaller。。。。。

windows 下的 ruby 不是一般的慢

#13 楼 @clc3123 比 jruby 还慢?ruby2.0 应该不慢吧?

railsintaller。。。。。。。。。

#16 楼 @zjtxlly 貌似还不支持 2.0 呢吧

#17 楼 @i5ting 1.9.3 反正没什么大区别 性能上的区别吧。。练习在 debian 上

win 下面最好别用 64 位 2.0……nokogiri 不能用……

windows 下安装 mysql2 貌似不会成功的,以前经历过,你搜下这个试试看,RailsFTW,也许能帮帮忙!

#20 楼 @zhangyanan 没装 devkit 吧~~~

#21 楼 @zjtxqjj 我安装了,我的环境 winxp 32,ruby 1.9.3 ,rails 3.2 可以运行

#22 楼 @zhangyanan 没装 devkitrails 也能运行啊。。不过就是有的 gem 编译不了装不上,或者你装了 devkit 看看路径什么的对不对。。。

标题好霸气!👍

匿名 #25 2013年11月27日

换 Unix/Linux 吧

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