gpt4 book ai didi

ruby - 在 Windows 上为 ruby​​ 安装 ncurses

转载 作者:可可西里 更新时间:2023-11-01 14:19:10 25 4
gpt4 key购买 nike

我正在尝试在 Windows 上为 ruby​​ 安装 ncurses。我以前没有在我的机器上安装过 ncurses。我以为拥有 "ruby devkit" ,它已经要求就足够了,但现在我被要求指定选项......我不知道选择哪个选项,或者我是否需要做/安装其他东西才能安装 gem:

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,这样我就可以运行它了:

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 的内容复制到您路径中的某处

C:\ncurses可以是任意目录

关于ruby - 在 Windows 上为 ruby​​ 安装 ncurses,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12934524/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com