Ruby 2.1.5 and RubyPython 0.6.3- RubyPython::InvalidInterpreter: An invalid interpreter was specified

烈酒焚心 提交于 2019-12-08 07:04:32

问题


I'm trying to use RubyPython on Debian 8 and have been unable to. RubyPython.start always raises an InvalidInterpreter exception. I've tried specifying the python interpreter executable but it doesn't matter. The snipped below shows my versions and attempting to start it from 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'

回答1:


I run strace -ff -o /tmp/pry.txt pry to see what happens when require rubypython and RubyPython.start are entered. There was lines like

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

meaning that rubypython code was trying to locate python library. What was absent was a successful stat for /usr/lib/x86_64-linux-gnu/libpython2.7.so file.

I modified file ~/.gem/ruby/2.1.0/gems/rubypython-0.6.3/lib/rubypython/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)

where the last line is what I inserted. After this RubyPython.start returned true.




回答2:


Updating RubyPython to 0.6.4 versions has resolved this issue for me.



来源:https://stackoverflow.com/questions/38400748/ruby-2-1-5-and-rubypython-0-6-3-rubypythoninvalidinterpreter-an-invalid-inte

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!