我尝试用以下方法测试rubypython
:
bundle exec irb
require 'rubypython'
RubyPython.start
这导致了一个错误。在
错误消息是:
^{pr2}$已安装Python 2.7:
irb(main):002:0> RubyPython.start(:python_exec => 'python2.7')
RubyPython::InvalidInterpreter: An invalid interpreter was specified.
from /home/nitrous/code/.bundle/gems/rubypython-0.6.3/lib/rubypython.rb:67:in `block in start'
from /home/nitrous/code/.bundle/gems/rubypython-0.6.3/lib/rubypython/python.rb:10:in `synchronize'
from /home/nitrous/code/.bundle/gems/rubypython-0.6.3/lib/rubypython/python.rb:10:in `synchronize'
from /home/nitrous/code/.bundle/gems/rubypython-0.6.3/lib/rubypython.rb:54:in `start'
from (irb):2
from /usr/local/opt/rbenv/versions/2.1.5/bin/irb:11:in `<main>'
文档建议我可以运行使用Ruby导入的Python,在我的例子中,可以通过Rspec进行测试,但事实并非如此
我应该能够从Ruby中导入并运行Python吗?在
在最近的Debian构建中使用RubyPython时,我曾多次遇到这个问题。在
问题在于RubyPython::Interpreter\find_python_lib方法。此方法使用硬编码路径和操作系统检测来查找库,而不是调用python config。在
我使用以下代码修复该方法:
如果pythonconfig找不到库,则调用原始(有缺陷)方法。在
相关问题 更多 >
编程相关推荐