无法使用pip安装FFMPEG。

huangapple go评论107阅读模式
英文:

Can't install FFMPEG using pip

问题

我尝试使用pip安装ffmpeg,命令如下:

pip install ffmpeg

然而,我遇到了以下错误:

Collecting ffmpeg
  Using cached ffmpeg-1.4.tar.gz (5.1 kB)
  Preparing metadata (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [34 lines of output]
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "C:\Users\vwu20\AppData\Local\Temp\pip-install-rdqrdeeq\ffmpeg_3cdda176f3f04ceea4a14d868e94924e\setup.py", line 13, in <module>
          setup(
        File "C:\Users\vwu20\AppData\Local\Programs\Python\Python310\lib\site-packages\setuptools\__init__.py", line 87, in setup
          return distutils.core.setup(**attrs)
        File "C:\Users\vwu20\AppData\Local\Programs\Python\Python310\lib\site-packages\setuptools\_distutils\core.py", line 147, in setup
          _setup_distribution = dist = klass(attrs)
        File "C:\Users\vwu20\AppData\Local\Programs\Python\Python310\lib\site-packages\setuptools\dist.py", line 476, in __init__
          _Distribution.__init__(
        File "C:\Users\vwu20\AppData\Local\Programs\Python\Python310\lib\site-packages\setuptools\_distutils\dist.py", line 282, in __init__
          self.finalize_options()
        File "C:\Users\vwu20\AppData\Local\Programs\Python\Python310\lib\site-packages\setuptools\dist.py", line 899, in finalize_options
          for ep in sorted(loaded, key=by_order):
        File "C:\Users\vwu20\AppData\Local\Programs\Python\Python310\lib\site-packages\setuptools\dist.py", line 898, in <lambda>
          loaded = map(lambda e: e.load(), filtered)
        File "C:\Users\vwu20\AppData\Local\Programs\Python\Python310\lib\importlib\metadata\__init__.py", line 171, in load
          module = import_module(match.group('module'))
        File "C:\Users\vwu20\AppData\Local\Programs\Python\Python310\lib\importlib\__init__.py", line 126, in import_module
          return _bootstrap._gcd_import(name[level:], package, level)
        File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
        File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
        File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
        File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
        File "<frozen importlib._bootstrap_external>", line 883, in exec_module
        File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
        File "C:\Users\vwu20\AppData\Local\Programs\Python\Python310\lib\site-packages\py2app\build_app.py", line 37, in <module>
          from py2app.create_appbundle import create_appbundle
        File "C:\Users\vwu20\AppData\Local\Programs\Python\Python310\lib\site-packages\py2app\create_appbundle.py", line 9, in <module>
          from py2app.util import make_exec, makedirs, mergecopy, mergetree, skipscm
        File "C:\Users\vwu20\AppData\Local\Programs\Python\Python310\lib\site-packages\py2app\util.py", line 5, in <module>
          import fcntl
      ModuleNotFoundError: No module named 'fcntl'
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.

错误信息表明缺少一个名为fcntl的包,因此我尝试使用以下命令安装它:

pip install fcntl

然而,尝试安装fcntl产生了以下错误:

ERROR: Could not find a version that satisfies the requirement fcntl (from versions: none)
ERROR: No matching distribution found for fcntl

有人能告诉我我做错了什么吗?我正在使用Windows 11,Python 3.10,pip 23.1.2。感谢帮助。

英文:

I tried to install ffmpeg using pip like this

pip install ffmpeg

However I got the following error:

Collecting ffmpeg
Using cached ffmpeg-1.4.tar.gz (5.1 kB)
Preparing metadata (setup.py) ... error
error: subprocess-exited-with-error
&#215; python setup.py egg_info did not run successfully.
│ exit code: 1
╰─&gt; [34 lines of output]
Traceback (most recent call last):
File &quot;&lt;string&gt;&quot;, line 2, in &lt;module&gt;
File &quot;&lt;pip-setuptools-caller&gt;&quot;, line 34, in &lt;module&gt;
File &quot;C:\Users\vwu20\AppData\Local\Temp\pip-install-rdqrdeeq\ffmpeg_3cdda176f3f04ceea4a14d868e94924e\setup.py&quot;, line 13, in &lt;module&gt;
setup(
File &quot;C:\Users\vwu20\AppData\Local\Programs\Python\Python310\lib\site-packages\setuptools\__init__.py&quot;, line 87, in setup
return distutils.core.setup(**attrs)
File &quot;C:\Users\vwu20\AppData\Local\Programs\Python\Python310\lib\site-packages\setuptools\_distutils\core.py&quot;, line 147, in setup
_setup_distribution = dist = klass(attrs)
File &quot;C:\Users\vwu20\AppData\Local\Programs\Python\Python310\lib\site-packages\setuptools\dist.py&quot;, line 476, in __init__
_Distribution.__init__(
File &quot;C:\Users\vwu20\AppData\Local\Programs\Python\Python310\lib\site-packages\setuptools\_distutils\dist.py&quot;, line 282, in __init__
self.finalize_options()
File &quot;C:\Users\vwu20\AppData\Local\Programs\Python\Python310\lib\site-packages\setuptools\dist.py&quot;, line 899, in finalize_options
for ep in sorted(loaded, key=by_order):
File &quot;C:\Users\vwu20\AppData\Local\Programs\Python\Python310\lib\site-packages\setuptools\dist.py&quot;, line 898, in &lt;lambda&gt;
loaded = map(lambda e: e.load(), filtered)
File &quot;C:\Users\vwu20\AppData\Local\Programs\Python\Python310\lib\importlib\metadata\__init__.py&quot;, line 171, in load
module = import_module(match.group(&#39;module&#39;))
File &quot;C:\Users\vwu20\AppData\Local\Programs\Python\Python310\lib\importlib\__init__.py&quot;, line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File &quot;&lt;frozen importlib._bootstrap&gt;&quot;, line 1050, in _gcd_import
File &quot;&lt;frozen importlib._bootstrap&gt;&quot;, line 1027, in _find_and_load
File &quot;&lt;frozen importlib._bootstrap&gt;&quot;, line 1006, in _find_and_load_unlocked
File &quot;&lt;frozen importlib._bootstrap&gt;&quot;, line 688, in _load_unlocked
File &quot;&lt;frozen importlib._bootstrap_external&gt;&quot;, line 883, in exec_module
File &quot;&lt;frozen importlib._bootstrap&gt;&quot;, line 241, in _call_with_frames_removed
File &quot;C:\Users\vwu20\AppData\Local\Programs\Python\Python310\lib\site-packages\py2app\build_app.py&quot;, line 37, in &lt;module&gt;
from py2app.create_appbundle import create_appbundle
File &quot;C:\Users\vwu20\AppData\Local\Programs\Python\Python310\lib\site-packages\py2app\create_appbundle.py&quot;, line 9, in &lt;module&gt;
from py2app.util import make_exec, makedirs, mergecopy, mergetree, skipscm
File &quot;C:\Users\vwu20\AppData\Local\Programs\Python\Python310\lib\site-packages\py2app\util.py&quot;, line 5, in &lt;module&gt;
import fcntl
ModuleNotFoundError: No module named &#39;fcntl&#39;
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed
&#215; Encountered error while generating package metadata.
╰─&gt; See above for output.
note: This is an issue with the package mentioned above, not pip.
hint: See above for details.

The error message says that it's missing a package called fcntl, so i tried to install it using

pip install fcntl

The attempt to install fcntl produce the following error:

ERROR: Could not find a version that satisfies the requirement fcntl (from versions: none)
ERROR: No matching distribution found for fcntl

Can anyone tell me what I did wrong? I am using windows 11, python 3.10, pip 23.1.2
Help would be appreciated.

答案1

得分: 3

这不是你想要的包。那个只支持Linux,并且不专业。相反,尝试:

pip install ffmpeg-python

然而,请注意,在执行此操作之前,您需要安装ffmpeg(命令行版本,而不是Python模块)。在git页面上有安装说明。

https://github.com/kkroening/ffmpeg-python

如果不清楚的话,ffmpeg 是一个非常大、复杂和功能强大的命令行工具包。Python模块实际上并不执行任何视频工作 - 它们只是构建复杂的ffmpeg命令行,然后运行它们。

英文:

That's not the package you want. That one is Linux only and is unprofessional. Instead, try:

pip install ffmpeg-python

Note, however, that you will need to install ffmpeg (the command line, not the Python module) before you do that. There are instructions on the git page.

https://github.com/kkroening/ffmpeg-python

In case it's not clear, ffmpeg is a very large, complicated, and capable command-line toolkit. The Python modules don't actually do any video work -- they all just build complicated ffmpeg command lines and then run them.

huangapple
  • 本文由 发表于 2023年6月22日 10:58:31
  • 转载请务必保留本文链接:https://go.coder-hub.com/76528335.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定