本文介绍了libv8 需要安装 python 2 才能构建 - Windows的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这就是我尝试在 Windows 上安装 libv8 的方法:

So this is how I try to install libv8 on my Windows:

D:\projects\perfstats>gem install libv8
Fetching: libv8-3.16.14.1.gem (100%)
Temporarily enhancing PATH to include DevKit...
Building native extensions.  This could take a while...
ERROR:  Error installing libv8:
        ERROR: Failed to build gem native extension.

        D:/Ruby193/bin/ruby.exe extconf.rb
creating Makefile
The system cannot find the path specified.
The system cannot find the path specified.
The system cannot find the path specified.
D:/Ruby193/lib/ruby/gems/1.9.1/gems/libv8-3.16.14.1/ext/libv8/builder.rb:49:in `setup_python!': libv8 requires python 2 to be installed in order to build, but it is currently not available (RuntimeError)
        from D:/Ruby193/lib/ruby/gems/1.9.1/gems/libv8-3.16.14.1/ext/libv8/builder.rb:35:in `block in build_libv8!'
        from D:/Ruby193/lib/ruby/gems/1.9.1/gems/libv8-3.16.14.1/ext/libv8/builder.rb:34:in `chdir'
        from D:/Ruby193/lib/ruby/gems/1.9.1/gems/libv8-3.16.14.1/ext/libv8/builder.rb:34:in `build_libv8!'
        from D:/Ruby193/lib/ruby/gems/1.9.1/gems/libv8-3.16.14.1/ext/libv8/location.rb:24:in `install!'
        from extconf.rb:7:in `<main>'

我安装了python 2.7并将其添加到路径中:

I installed python 2.7 and added it to the path:

D:\projects\perfstats>python -V
Python 2.7.3

任何想法在这种情况下可能的解决方案是什么?

Any ideas what could be the solution in this case?

推荐答案

有一些解决方法可以解决此问题尝试运行: gem install libv8 -v '3.16.14.1' -- --with-system-v8

There are some work-around to fix the problemTry to run this: gem install libv8 -v '3.16.14.1' -- --with-system-v8

或者我们像这样在 Gemfile 中将它们分开

Or we separate them in the Gemfile like this

group :production do
 gem 'libv8', '~> 3.11.8.3'
 gem 'therubyracer', :platform => :ruby
end

然后运行 ​​bundle 命令:捆绑安装开发或捆绑安装 -- 无需生产

And then run the bundle command:bundle install development orbundle install --without production

这篇关于libv8 需要安装 python 2 才能构建 - Windows的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-25 18:50