我正在尝试在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'
答案 0 :(得分:1)
我运行strace -ff -o /tmp/pry.txt pry
以查看输入require rubypython
和RubyPython.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 / 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)
最后一行是我插入的。在此RubyPython.start
返回true
。
答案 1 :(得分:0)
将RubyPython
更新为0.6.4
个版本已经为我解决了这个问题。