【问题标题】:libv8 required python 2 to be installed in order to build - Windows [duplicate]libv8需要安装python 2才能构建-Windows [重复]
【发布时间】:2013-06-27 15:01:01
【问题描述】:

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

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

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

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

【问题讨论】:

  • 在修改PATH之后重启了上面示例中使用的cmd.exe的实例吗?
  • 是的,我记得这个。
  • 我对 Ruby 一无所知,但看看a similar question,它似乎不是为在 Windows 上工作而设计的。 which python2 2&gt;&amp;1 &gt; /dev/null 非常特定于 Unix。
  • 你不应该需要 libv8 gem,这通常只在不包含开箱即用的 JS 引擎的平台上需要(Windows 有)。您可以发布您的 Gemfile 吗?

标签: python ruby-on-rails


【解决方案1】:

有一些解决方法可以解决此问题 尝试运行: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

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

【讨论】:

  • 我在 devkit 提示符下运行它,它工作了
【解决方案2】:

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

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

这也将安装 libv8 gem,应该可以解决您的问题。

【讨论】:

  • 获取 v8_context.rb:2:in require': cannot load such file -- v8 (LoadError) on running rails 服务器`。此外,我在 Gemfile.lock 中没有看到 libv8
  • @miparnisari 修复了链接。
猜你喜欢
  • 2019-05-19
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2015-11-21
  • 2012-07-08
  • 1970-01-01
  • 2014-07-23
相关资源
最近更新 更多