如何在 windows 上将 rubygems 平台从 x86-mingw32 更改为 x86-mswin32-60
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/3272792/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to change rubygems platform from x86-mingw32 to x86-mswin32-60 on windows
提问by Boris
I am doing some ruby scripting in windows, which involves opening and closing a browser. To that end I needed some special gems to interface to the native windows system calls. But when I tried
我正在 Windows 中编写一些 ruby 脚本,这涉及打开和关闭浏览器。为此,我需要一些特殊的 gem 来连接本地 Windows 系统调用。但是当我尝试
> gem install sys-proctable
, it yielded
,它产生了
ERROR: Could not find a valid gem ′sys-proctable′ (>= 0), here is why:
Found sys-proctable (0.9.0), but was for platforms x86-darwin-8
,x86-freebsd-7 ,x86-solaris-2.10 ,x86-linux ,x86-mswin32-60
The problem is that my gem installation does not have the x86-mswin32-60 rubygems platform
问题是我的gem安装没有x86-mswin32-60 rubygems平台
> gem environment
RubyGems Environment:
- RUBYGEMS VERSION: 1.3.7
- RUBY VERSION: 1.8.7 (2010-01-10 patchlevel 249) [i386-mingw32]
...
- RUBYGEMS PLATFORMS:
- ruby
- x86-mingw32
...
It seems that the problem comes from my version of ruby being compiled with mingw libraries. So my question is: how can I get a version of ruby, where rubygems platforms include x86-mswin32-60? I cannot find any installers from rubyinstaller.org which are not mingw.
看来问题出在我用 mingw 库编译的 ruby 版本上。所以我的问题是:如何获得 ruby 版本,其中 rubygems 平台包括 x86-mswin32-60?我无法从 rubyinstaller.org 找到任何不是 mingw 的安装程序。
--- edit ---
- - 编辑 - -
That last part was a bit hasty. Actually, rubyinstaller.org has the legacy one-click installers, which were built for mswin32. But that install had some other problems for me, so I guess I will try the solution from Luis below.
最后一部分有点仓促。实际上,rubyinstaller.org 有为 mswin32 构建的旧式一键安装程序。但是那个安装对我来说还有其他一些问题,所以我想我会尝试下面 Luis 的解决方案。
回答by Luis Lavena
You can force the gem installation specifying --platform
option:
您可以强制使用 gem 安装指定--platform
选项:
gem install sys-proctable --platform=x86-mswin32-60
However, I advise against it for several reasons, some I've mentioned in my blog here
但是,我反对这样做有几个原因,一些我在我的博客中提到这里
Please test first and see if it will work before pushing a code that is based on this into a production environment.
在将基于此的代码推送到生产环境之前,请先进行测试,看看它是否有效。
Hope that helps.
希望有帮助。