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

标签 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>'

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

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

有什么想法可以解决这种情况?

最佳答案

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

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

关于python - libv8 需要安装 python 2 才能构建 - Windows,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17346681/

相关文章:

python - 连接操作后如何避免重复列?

python - OpenStreetMap 背景上的 Cartopy 热图

python - 在 Python 上使用 patoolib 解压时出现错误

ruby-on-rails - 什么时候在 Rails 中使用私有(private)方法?

ruby-on-rails - 给定日期和星期几,找到 future 最接近的日期

python - 如何将 JSON 时间序列与具有相同列名的 pandas 一起使用

python - 如何使用存储在 TFRecords 文件中的图像为 Estimator 构建 input_fn

ruby-on-rails - 如何完全删除 Ruby on Rails 上的数据库?

ruby-on-rails - 如何在select中命名空白值?

ruby-on-rails - 自升级到 rails 3.1 以来,form_for 参数数量错误(3 为 2)