无法在python中添加“gphoto2”

问题描述 投票:0回答:1

我正在使用 python 3.12.3pip 24.2。我正在尝试安装“gphoto2”以与 DSLR 相机配合使用。当我进来的时候

pip3 安装 gphoto2

我收到以下错误:

Collecting gphoto2
  Using cached gphoto2-2.5.0.tar.gz (497 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... error
  error: subprocess-exited-with-error

  × Getting requirements to build wheel did not run successfully.
  │ exit code: 1
  ╰─> [35 lines of output]
      Traceback (most recent call last):
        File "<string>", line 101, in <module>
        File "C:\Users\mg\AppData\Local\Programs\Python\Python312\Lib\subprocess.py", line 466, in check_output      
          return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "C:\Users\mg\AppData\Local\Programs\Python\Python312\Lib\subprocess.py", line 548, in run
          with Popen(*popenargs, **kwargs) as process:
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "C:\Users\mg\AppData\Local\Programs\Python\Python312\Lib\subprocess.py", line 1026, in __init__
          self._execute_child(args, executable, preexec_fn, close_fds,
        File "C:\Users\mg\AppData\Local\Programs\Python\Python312\Lib\subprocess.py", line 1538, in _execute_child   
          hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      FileNotFoundError: [WinError 2] The system cannot find the file specified

      During handling of the above exception, another exception occurred:

      Traceback (most recent call last):
        File "C:\Users\mg\PycharmProjects\Autospritz_image\.venv\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 353, in <module>
          main()
        File "C:\Users\mg\PycharmProjects\Autospritz_image\.venv\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 335, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "C:\Users\mg\PycharmProjects\Autospritz_image\.venv\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 118, in get_requires_for_build_wheel
          return hook(config_settings)
                 ^^^^^^^^^^^^^^^^^^^^^
        File "C:\Users\mg\AppData\Local\Temp\pip-build-env-wchn31vj\overlay\Lib\site-packages\setuptools\build_meta.py", line 332, in get_requires_for_build_wheel
          return self._get_build_requires(config_settings, requirements=[])
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "C:\Users\mg\AppData\Local\Temp\pip-build-env-wchn31vj\overlay\Lib\site-packages\setuptools\build_meta.py", line 302, in _get_build_requires
          self.run_setup()
y", line 318, in run_setup
        File "<string>", line 104, in <module>
      [end of output]

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

× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> See above for output.

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

后来我也尝试了22.1.0的pip版本,但遇到了另一个错误:

    ERROR: Exception:
Traceback (most recent call last):
  File "C:\Users\mg\PycharmProjects\Autospritz_image\.venv\Lib\site-packages\pip\_internal\cli\base_command.py", line 167, in exc_logging_wrapper
    status = run_func(*args)
             ^^^^^^^^^^^^^^^
  File "C:\Users\mg\PycharmProjects\Autospritz_image\.venv\Lib\site-packages\pip\_internal\cli\req_command.py", line 205, in wrapper
    return func(self, options, args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\mg\PycharmProjects\Autospritz_image\.venv\Lib\site-packages\pip\_internal\commands\install.py", line 286, in run
    session = self.get_default_session(options)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\mg\PycharmProjects\Autospritz_image\.venv\Lib\site-packages\pip\_internal\cli\req_command.py", line 75, in get_default_session
    self._session = self.enter_context(self._build_session(options))
                                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\mg\PycharmProjects\Autospritz_image\.venv\Lib\site-packages\pip\_internal\cli\req_command.py", line 89, in _build_session
    session = PipSession(
              ^^^^^^^^^^^
  File "C:\Users\mg\PycharmProjects\Autospritz_image\.venv\Lib\site-packages\pip\_internal\network\session.py", line 282, in __init__
    self.headers["User-Agent"] = user_agent()
                                 ^^^^^^^^^^^^
  File "C:\Users\mg\PycharmProjects\Autospritz_image\.venv\Lib\site-packages\pip\_internal\network\session.py", line 157, in user_agent
    setuptools_dist = get_default_environment().get_distribution("setuptools")
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\mg\PycharmProjects\Autospritz_image\.venv\Lib\site-packages\pip\_internal\metadata\importlib\_envs.py", line 163, in get_distribution
    return next(matches, None)
           ^^^^^^^^^^^^^^^^^^^
  File "C:\Users\mg\PycharmProjects\Autospritz_image\.venv\Lib\site-packages\pip\_internal\metadata\importlib\_envs.py", line 158, in <genexpr>
    matches = (
              ^
  File "C:\Users\mg\PycharmProjects\Autospritz_image\.venv\Lib\site-packages\pip\_internal\metadata\base.py", line 485, in iter_all_distributions
    for dist in self._iter_distributions():
  File "C:\Users\mg\PycharmProjects\Autospritz_image\.venv\Lib\site-packages\pip\_internal\metadata\importlib\_envs.py", line 151, in _iter_distributions
    for dist in finder.find_eggs(location):
  File "C:\Users\mg\PycharmProjects\Autospritz_image\.venv\Lib\site-packages\pip\_internal\metadata\importlib\_envs.py", line 119, in find_eggs
    yield from self._find_eggs_in_dir(location)
  File "C:\Users\mg\PycharmProjects\Autospritz_image\.venv\Lib\site-packages\pip\_internal\metadata\importlib\_envs.py", line 86, in _find_eggs_in_dir
    from pip._vendor.pkg_resources import find_distributions
  File "C:\Users\mg\PycharmProjects\Autospritz_image\.venv\Lib\site-packages\pip\_vendor\pkg_resources\__init__.py", line 2164, in <module>
    register_finder(pkgutil.ImpImporter, find_on_path)
                    ^^^^^^^^^^^^^^^^^^^
AttributeError: module 'pkgutil' has no attribute 'ImpImporter'. Did you mean: 'zipimporter'?
Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "C:\Users\mg\PycharmProjects\Autospritz_image\.venv\Lib\site-packages\pip\__main__.py", line 31, in <module>  
    sys.exit(_main())
             ^^^^^^^
  File "C:\Users\mg\PycharmProjects\Autospritz_image\.venv\Lib\site-packages\pip\_internal\cli\main.py", line 70, in main
    return command.main(cmd_args)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\mg\PycharmProjects\Autospritz_image\.venv\Lib\site-packages\pip\_internal\cli\base_command.py", line 101, in main
    return self._main(args)
           ^^^^^^^^^^^^^^^^
  File "C:\Users\mg\PycharmProjects\Autospritz_image\.venv\Lib\site-packages\pip\_internal\cli\base_command.py", line 223, in _main
    self.handle_pip_version_check(options)
  File "C:\Users\mg\PycharmProjects\Autospritz_image\.venv\Lib\site-packages\pip\_internal\cli\req_command.py", line 144, in handle_pip_version_check
    session = self._build_session(
              ^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\mg\PycharmProjects\Autospritz_image\.venv\Lib\site-packages\pip\_internal\cli\req_command.py", line 89, in _build_session
    session = PipSession(
              ^^^^^^^^^^^
  File "C:\Users\mg\PycharmProjects\Autospritz_image\.venv\Lib\site-packages\pip\_internal\network\session.py", line 282, in __init__
    self.headers["User-Agent"] = user_agent()
                                 ^^^^^^^^^^^^
  File "C:\Users\mg\PycharmProjects\Autospritz_image\.venv\Lib\site-packages\pip\_internal\network\session.py", line 157, in user_agent
    setuptools_dist = get_default_environment().get_distribution("setuptools")
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\mg\PycharmProjects\Autospritz_image\.venv\Lib\site-packages\pip\_internal\metadata\importlib\_envs.py", line 163, in get_distribution
    return next(matches, None)
           ^^^^^^^^^^^^^^^^^^^
  File "C:\Users\mg\PycharmProjects\Autospritz_image\.venv\Lib\site-packages\pip\_internal\metadata\importlib\_envs.py", line 158, in <genexpr>
    matches = (
              ^
  File "C:\Users\mg\PycharmProjects\Autospritz_image\.venv\Lib\site-packages\pip\_internal\metadata\base.py", line 485, in iter_all_distributions
    for dist in self._iter_distributions():
  File "C:\Users\mg\PycharmProjects\Autospritz_image\.venv\Lib\site-packages\pip\_internal\metadata\importlib\_envs.py", line 151, in _iter_distributions
    for dist in finder.find_eggs(location):
  File "C:\Users\mg\PycharmProjects\Autospritz_image\.venv\Lib\site-packages\pip\_internal\metadata\importlib\_envs.py", line 119, in find_eggs
    yield from self._find_eggs_in_dir(location)
  File "C:\Users\mg\PycharmProjects\Autospritz_image\.venv\Lib\site-packages\pip\_internal\metadata\importlib\_envs.py", line 86, in _find_eggs_in_dir
    from pip._vendor.pkg_resources import find_distributions
  File "C:\Users\mg\PycharmProjects\Autospritz_image\.venv\Lib\site-packages\pip\_vendor\pkg_resources\__init__.py", line 2164, in <module>
    register_finder(pkgutil.ImpImporter, find_on_path)
                    ^^^^^^^^^^^^^^^^^^^
AttributeError: module 'pkgutil' has no attribute 'ImpImporter'. Did you mean: 'zipimporter'?

有人可以帮我在 python 中添加“gphoto2”吗?我正在查看以下页面(https://github.com/jim-easterbrook/python-gphoto2/tree/main)以供参考。

python windows installation pip virtualenv
1个回答
0
投票

gphoto2
不适用于 Windows。

它仅适用于 MacOS 和 POSIX 兼容 (Linux)。

enter image description here

https://pypi.org/project/gphoto2/#deprecated-functions

© www.soinside.com 2019 - 2024. All rights reserved.