libv8需要安装python 2才能构建--Windows

use*_*677 13 python ruby-on-rails

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

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>'
Run Code Online (Sandbox Code Playgroud)

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

D:\projects\perfstats>python -V
Python 2.7.3
Run Code Online (Sandbox Code Playgroud)

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

Arm*_*ega 15

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

或者我们在Gemfile中将它们分开

group :production do
 gem 'libv8', '~> 3.11.8.3'
 gem 'therubyracer', :platform => :ruby
end
Run Code Online (Sandbox Code Playgroud)

然后运行bundle命令:bundle install development或bundle install --without production

  • 我从devkit提示符运行它,它工作 (2认同)

Mar*_*erl 6

我在尝试在Windows上安装therubyracer gem时遇到了同样的问题.

尝试安装GitHub包therubyracer_for_windows并将v8.dll&复制v8preparser.dll到您的ruby\bin文件夹中.

这也将安装libv8 gem并解决您的问题.

  • 在`require'中获取v8_context.rb:2:不能加载这样的文件-正在运行的`rails服务器`上的v8(LoadError)。此外,我在Gemfile.lock中看不到libv8 (2认同)