在Windows上为Ruby安装Ncurses [英] Installing ncurses for ruby on Windows

查看:89
本文介绍了在Windows上为Ruby安装Ncurses的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在Windows上为ruby安装ncurses.我之前尚未在计算机上安装ncurses.我以为拥有"ruby​​ devkit" ,就足够了,但是现在我被要求指定选项...我不知道该选择哪些选项,或者我是否需要执行/安装其他操作才能安装gem:

I am trying to install ncurses for ruby on windows. I have not installed ncurses before on my machine. I thought that having the "ruby devkit", it had asked for would be enough, but now I am being asked to specify options... I don't know which options to pick, or if I need to do/install other things for the gem to get installed:

C:\Ruby193\Devkit>gem install ncurses -- --ruby=C:/Ruby193/bin/ruby --without-make-prog --without-opt-dir
Temporarily enhancing PATH to include DevKit...
Building native extensions.  This could take a while...
ERROR:  Error installing ncurses:
        ERROR: Failed to build gem native extension.

        C:/Ruby193/bin/ruby.exe extconf.rb --ruby=C:/Ruby193/bin/ruby --without-make-prog --without-opt-dir
C:/Ruby193/lib/ruby/1.9.1/shellwords.rb:35:in `shellsplit': undefined method `scan' for false:FalseClass (NoMethodError)
        from C:/Ruby193/lib/ruby/1.9.1/mkmf.rb:2216:in `<top (required)>'
        from C:/Ruby193/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
        from C:/Ruby193/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
        from extconf.rb:22:in `<main>'


Gem files will remain installed in C:/Ruby193/lib/ruby/gems/1.9.1/gems/ncurses-0.9.1 for inspection.
Results logged to C:/Ruby193/lib/ruby/gems/1.9.1/gems/ncurses-0.9.1/./gem_make.out

痛苦的是,我只想安装此gem,以便我可以运行它:

WHAT A PAIN, I just want to get this gem installed so I can run this:

require 'curses'
cols = Curses.stdscr.maxx
msg = "random_string"
str = msg.center(msg.length + cols - msg.length - 5 - 3)
puts "<!-- #{str}-->"

推荐答案

更新版本:

  1. 获取ncurses(MinGW端口): http://invisible-island.net/ncurses/
  2. 将其放入C:\ ncurses
  3. gem install curses --platform=ruby -- --with-ncurses-dir="C:\ncurses"
  4. 将C:\ ncurses \ bin的内容复制到路径中的某处
  1. Get ncurses (MinGW Port): http://invisible-island.net/ncurses/
  2. Put it in C:\ncurses
  3. gem install curses --platform=ruby -- --with-ncurses-dir="C:\ncurses"
  4. Copy the contents of C:\ncurses\bin to somewhere in your path

C:\ ncurses可以是任何目录

C:\ncurses can be any directory

这篇关于在Windows上为Ruby安装Ncurses的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆