gpt4 book ai didi

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

转载 作者:太空宇宙 更新时间:2023-11-03 16:21:41 24 4
gpt4 key购买 nike

我尝试在 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'

最佳答案

我运行 strace -ff -o/tmp/pry.txt pry 来看看当 require ruby​​pythonRubyPython.start 是时会发生什么进入。有这样的行

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

意味着 ruby​​python 代码正在尝试查找 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 后。

关于python - Ruby 2.1.5 和 RubyPython 0.6.3- RubyPython::InvalidInterpreter:指定了无效的解释器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38400748/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com