Ruby 可执行文件不会在 Win10 和 Win7 上启动 [英] Ruby executable won't start on Win10 and Win7

查看:24
本文介绍了Ruby 可执行文件不会在 Win10 和 Win7 上启动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用 Tk 写了一个 ruby​​ 应用程序,一切都很好,没有错误等.所以我用 Ocra 制作了一个 exe,一开始我遇到了一些问题,但后来我解决了,Ocra 制作的 exe 没有错误,而且当它让你在编译之前尝试你的脚本时,没有任何问题.

I wrote a ruby application with Tk, and everything is fine, no errors or such. So i made an exe with Ocra and i had some problems at the start but then i solved, Ocra made the exe with no errors and also when it let's you try your script before conpiling it, there were no problems.

但是当我双击 exe 时,什么也没有.我等了,什么都没有.以管理员身份运行它,然后什么都没有.

But then when i double clicked the exe, nothing. I waited, and nothing.. Run it as admin and nothing again..

我也尝试过写一个简单的脚本,就像一个 hello world 但总是同样的问题:

I also tried to write a simple script, just like an hello world but always the same issue:

屏幕或 cmd 中没有弹出错误,但是当我使用 TK 运行 Ocra ruby​​ 可执行文件时仍然没有任何反应

No errors popped up on screen or in cmd, but still nothing happens when i run an Ocra ruby executable with TK

这是 ocra 的输出:

This is the ocra output:

G:WinRubyefdsk>ocra efdsk.rb --windows --no-autoload --debug                                                          
=== Loading script to check dependencies                                                                                
=== Detected gem did_you_mean-1.2.0 (loaded, files)                                                                     
===     19 files, 38722 bytes                                                                                           
=== Detected gem ocra-1.3.10 (loaded, files)                                                                            
===     5 files, 210830 bytes                                                                                           
=== Detected gem tk-0.2.0 (loaded, files)                                                                               
===     419 files, 4623427 bytes                                                                                        
=== Including 59 encoding support files (3909616 bytes, use --no-enc to exclude)                                        
=== Building efdsk-debug.exe                                                                                            
=== Enabling debug mode in executable                                                                                   
=== Adding user-supplied source files                                                                                   
=== Adding ruby executable rubyw.exe                                                                                    
=== Adding detected DLL C:/Ruby25-x64/bin/ruby_builtin_dlls/libgmp-10.dll                                               
=== Adding detected DLL C:/Ruby25-x64/bin/ruby_builtin_dlls/libffi-6.dll                                                
=== Adding detected DLL C:/Ruby25-x64/msys64/mingw64/bin/tcl86.dll                                                      
=== Adding detected DLL C:/Ruby25-x64/msys64/mingw64/bin/tk86.dll                                                       
=== Adding detected DLL C:/Ruby25-x64/bin/ruby_builtin_dlls/zlib1.dll                                                   
=== Adding detected DLL C:/Ruby25-x64/msys64/mingw64/lib/reg1.3/tclreg13.dll                                            
=== Adding external manifest C:/Ruby25- 
x64/bin/ruby_builtin_dlls/ruby_builtin_dlls.manifest                             
=== Adding library files                                                                                                
=== Compressing 16872997 bytes                                                                                                                                                                                                                  
LZMA 4.65 : Igor Pavlov : Public domain : 2009-02-03                                                                    
=== Finished building efdsk-debug.exe (4029675 bytes) 

这是我尝试启动 exe 文件时的输出

And this is the output when i try to start the exe file

G:WinRubyefdsk>start efdsk.exe

G:WinRubyefdsk> 

这样的简单脚本也不会启动:

Also a simple script like this won't start:

require 'tk'
require 'tkextlib/tile'

root = TkRoot.new() 
button = Tk::Tile::TButton.new(root) {text "Hello World"}.grid

Tk.mainloop()

我的红宝石版本:

ruby 2.5.1p57 (2018-03-29 revision 63029) [x64-mingw32]

推荐答案

我通过安装这个 ruby​​ 版本解决了:

I solved by installing this ruby version:

G:WinRubyefdsk>ruby -v                                                                                                
ruby 2.3.3p222 (2016-11-21 revision 56859) [x64-mingw32]

这是我用于 ocra 的命令:

And this is the command i used for ocra:

ocra efdsk.rb --windows C:Ruby23-x64lib	cltk --no-autoload --add-all-core

现在exe文件双击后就可以正常运行了.

Now the exe file will run normally after double clicking it.

这篇关于Ruby 可执行文件不会在 Win10 和 Win7 上启动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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