Ruby 2.1.5和RubyPython 0.6.3- RubyPython :: InvalidInterpreter:指定了无效的解释器

时间:2016-07-15 16:13:20

标签: python ruby rubypython

我正在尝试在Debian 8上使用RubyPython并且无法使用。 RubyPython.start总是引发InvalidInterpreter例外。我已经尝试指定python解释器可执行文件,但它没关系。下面的剪辑显示了我的版本并尝试从pry

启动它
rubypython (0.6.3)
adrew@bunny:~$ ruby --version
ruby 2.1.5p273 (2014-11-13) [x86_64-linux-gnu]
adrew@bunny:~$ python --version
Python 2.7.9
adrew@bunny:~$ which python2.7
/usr/bin/python2.7
adrew@bunny:~$ pry
[1] pry(main)> require 'rubypython'
=> true
[2] pry(main)> RubyPython.start
RubyPython::InvalidInterpreter: An invalid interpreter was specified.
from /var/lib/gems/2.1.0/gems/rubypython-0.6.3/lib/rubypython.rb:67:in `block in start'
[3] pry(main)> RubyPython.start(:python_exe => "/usr/bin/python2.7")
RubyPython::InvalidInterpreter: An invalid interpreter was specified.
from /var/lib/gems/2.1.0/gems/rubypython-0.6.3/lib/rubypython.rb:67:in `block in start'

2 个答案:

答案 0 :(得分:1)

我运行strace -ff -o /tmp/pry.txt pry以查看输入require rubypythonRubyPython.start时会发生什么。有像

这样的行
stat("/usr/lib/libpython2.7.so", 0x7ffd2bf4cde0) = -1 ENOENT (No such file or directory)

意思是rubypython代码试图找到python库。缺少的是/usr/lib/x86_64-linux-gnu/libpython2.7.so文件成功stat

我修改了文件〜/ .gem / ruby​​ / 2.1.0 / gems / ruby​​python-0.6.3 / lib / ruby​​python / interpreter.rb

if ::FFI::Platform::ARCH != 'i386'
   @locations << File.join("/opt/local/lib64", name)
   @locations << File.join("/opt/lib64", name)
   @locations << File.join("/usr/local/lib64", name)
   @locations << File.join("/usr/lib64", name)
   @locations << File.join("/usr/lib/x86_64-linux-gnu", name)

最后一行是我插入的。在此RubyPython.start返回true

之后

答案 1 :(得分:0)

RubyPython更新为0.6.4个版本已经为我解决了这个问题。