windows下安裝ruby devkit

超簡單的辦法

如果你是ruby剛入門,推薦這個方法。


如果通過上面方法安裝DevKit成功率會比較高,下面這種方法不一定能成。但如果你想折騰,可以來試試下面的手動安裝。

windows下安裝或升級時gem經常會碰到
1 Please update your PATH to include build tools or download the DevKit
2 from 'http://rubyinstaller.org/downloads' and follow the instructions
3 at 'http://github.com/oneclick/rubyinstaller/wiki/Development-Kit'

這是因爲沒有安裝DevKit的緣故。

DevKit 是windows平臺下編譯和使用本地C/C++擴展包的工具。它就是用來模擬Linux平臺下的make, gcc, sh來進行編譯。注:這個方法目前僅支持通過RubyInstaller安裝的Ruby,如果不是建議你重新安裝。安裝方法:雙擊下載的7z文件,指定解壓路徑,路徑中不能有空格。如C:\DevKit,這個路徑就是<DEVKIT_INSTALL_DIR>。
1 > cd <DEVKIT_INSTALL_DIR>
2 > ruby dk.rb init
3 #生成config.yml,這裏會檢查將要添加DevKit支持的Ruby列表,只支持通過RubyInstaller安裝的Ruby
4 #如果這裏列出的Ruby與你的要求不符,可以手動修改
5 > ruby dk.rb review  #檢查要添加DevKit支持的Ruby列表是否有誤,可以略過
6 > ruby dk.rb install
7 [INFO] Updating convenience notice gem override for 'C:/Ruby187'
8 [INFO] Installing 'C:/Ruby187/lib/ruby/site_ruby/devkit.rb'

檢查是否安裝成功
1 > gem install rdiscount --platform=ruby
2 Fetching: rdiscount-1.6.8.gem (100%)
3 Temporarily enhancing PATH to include DevKit...
4 Building native extensions.  This could take a while...
5 Successfully installed rdiscount-1.6.8
6 1 gem installed
7 Installing ri documentation for rdiscount-1.6.8...
8 Installing RDoc documentation for rdiscount-1.6.8...

如果能安裝rdiscount成功說明安裝DevKit成功

 

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章