简体   繁体   English

Exiftool::ExiftoolNotInstalled (Exiftool::ExiftoolNotInstalled) 安装后

[英]Exiftool::ExiftoolNotInstalled (Exiftool::ExiftoolNotInstalled) after being installed

I'm trying to run a ruby script where I used the exiftool gem, and everytime I'm trying to run it I keep getting this error even after installed it.我正在尝试运行一个 ruby 脚本,我在其中使用了 exiftool gem,每次我尝试运行它时,即使在安装之后我也会不断收到此错误。 Also, after running bundler as well.此外,在运行 bundler 之后也是如此。

在此处输入图像描述

Traceback (most recent call last):
C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/exiftool-1.2.4/lib/exiftool.rb:60:in `initialize': Exiftool::ExiftoolNotInstalled (Exiftool::ExiftoolNotInstalled)

在此处输入图像描述

Also, it is running on my cmd. I tried testing it using the irb and the Exiftool isn't being recognized by ruby.此外,它正在我的 cmd 上运行。我尝试使用 irb 对其进行测试,但 ruby 无法识别 Exiftool。

在此处输入图像描述

I'm maintainer of the exiftool.rb and exiftool_vendored.rb repos.我是exiftool.rbexiftool_vendored.rb 存储库的维护者。 @Zeragamba is correct that gem doesn't support Windows environments. @Zeragamba 是正确的,gem 不支持 Windows 环境。 The need for running it on Windows hasn't been brought up to our attention in the past 10 years.在过去的 10 年里,我们并未注意到需要在 Windows 上运行它。 I've looked at the issue and cut a separate branch that should work with Windows, however I'm not planning to fully support Windows unless there is an overwhelming demand.我已经查看了这个问题并切出了一个应该与 Windows 一起使用的单独分支,但是我不打算完全支持 Windows 除非有压倒性的需求。 There are a few gotchas related to implementing Windows support and I'm not sure if it's worth the time and effort to solve them at this point.有一些与实现 Windows 支持相关的陷阱,我不确定此时是否值得花时间和精力来解决它们。

Couple of things that you would need to do to get it working:您需要做几件事才能使其正常工作:

  1. If installed, remove exiftool_vendored.rb gem from your Windows system - it installs perl version of the exiftool from Phil Harvey.如果已安装,请从您的 Windows 系统中删除exiftool_vendored.rb gem - 它会安装来自 Phil Harvey 的 exiftool 的 perl 版本。

  2. Make sure that you are able to run git client commands in your PowerShell prompt确保您能够在 PowerShell 提示符下运行git客户端命令

I've tested the following setup on Windows 10 and ruby 2.7.5p203 (2021-11-24 revision f69aeb8314) [x64-mingw32]我已经在Windows 10ruby 2.7.5p203 (2021-11-24 revision f69aeb8314) [x64-mingw32]上测试了以下设置

  1. Download and install Windows executable from Phil Harvey's Exiftool site make sure that exiftool is in your PATH and can be executed in the PowerShellPhil Harvey 的 Exiftool 站点下载并安装 Windows 可执行文件,确保 exiftool 在您的PATH中并且可以在 PowerShell 中执行

  2. Create following Gemfile :创建以下Gemfile

source 'https://rubygems.org'
gem 'exiftool', github: 'exiftool-rb/exiftool.rb', branch: 'win_support'
  1. Run bundle install to get exiftool from that branch.运行bundle install以从该分支获取exiftool
  2. Create a test.rb file to test test the installation:创建一个test.rb文件来测试安装:
require 'exiftool'

puts "Exiftool command: #{Exiftool.command}"
puts "Is Exiftool Installed?: #{Exiftool.exiftool_installed?}"
puts "Exiftool version: #{Exiftool.exiftool_version}"

After running it you should get something along these lines:运行它之后,您应该得到以下信息:

PS C:\Users\sergey>ruby .\test.rb
Exiftool command: exiftool
Is Exiftool Installed?: true
Exiftool version: 12.40

Once again please keep in mind that this isn't an official version that supports Windows environment.再次请记住,这不是支持 Windows 环境的正式版本。 Feel free to open an issue on the github if you strongly feel that gem needs to support Windows environments, PRs are always welcome as well.如果您强烈认为 gem 需要支持 Windows 环境,请随时在 github 上提出问题,也欢迎 PR。

Thanks.谢谢。

Looks like the exiftool gem does not currently support windows environments.看起来 exiftool gem 目前不支持 windows 环境。 It often appends 2> /dev/null/ when running shell commands.它经常在运行 shell 命令时附加2> /dev/null/

You could potentually try running the script under WSL, or could try invoking the commands directly.您可能会尝试在 WSL 下运行脚本,或者可以尝试直接调用命令。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM