如何通过pip安装Yotta

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

我无法在 Windows 11 系统上安装 Yotta。我已经安装了依赖项,但是当我在 python 3.12、pip 版本 24.0 上执行以下命令时,它失败了。

pip install -U yotta

我收到的错误消息似乎与 python PyYAML 模块有关,但我不确定如何。这是消息:

Collecting pyyaml<6.0,>=5.1 (from valinor<2.0,>=1.1.4->yotta)
  Using cached PyYAML-5.4.1.tar.gz (175 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
  ╰─> [54 lines of output]
      running egg_info
      writing lib3\PyYAML.egg-info\PKG-INFO
      writing dependency_links to lib3\PyYAML.egg-info\dependency_links.txt
      writing top-level names to lib3\PyYAML.egg-info\top_level.txt
      Traceback (most recent call last):
        File "C:\Python312\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 353, in <module>
          main()
        File "C:\Python312\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:\Python312\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\dobbob11\AppData\Local\Temp\pip-build-env-brjy816p\overlay\Lib\site-packages\setuptools\build_meta.py", line 325, in get_requires_for_build_wheel
          return self._get_build_requires(config_settings, requirements=['wheel'])
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "C:\Users\dobbob11\AppData\Local\Temp\pip-build-env-brjy816p\overlay\Lib\site-packages\setuptools\build_meta.py", line 295, in _get_build_requires
          self.run_setup()
        File "C:\Users\dobbob11\AppData\Local\Temp\pip-build-env-brjy816p\overlay\Lib\site-packages\setuptools\build_meta.py", line 311, in run_setup
          exec(code, locals())
        File "<string>", line 271, in <module>
        File "C:\Users\dobbob11\AppData\Local\Temp\pip-build-env-brjy816p\overlay\Lib\site-packages\setuptools\__init__.py", line 103, in setup
          return distutils.core.setup(**attrs)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "C:\Users\dobbob11\AppData\Local\Temp\pip-build-env-brjy816p\overlay\Lib\site-packages\setuptools\_distutils\core.py", line 184, in setup
          return run_commands(dist)
                 ^^^^^^^^^^^^^^^^^^
        File "C:\Users\dobbob11\AppData\Local\Temp\pip-build-env-brjy816p\overlay\Lib\site-packages\setuptools\_distutils\core.py", line 200, in run_commands
          dist.run_commands()
        File "C:\Users\dobbob11\AppData\Local\Temp\pip-build-env-brjy816p\overlay\Lib\site-packages\setuptools\_distutils\dist.py", line 969, in run_commands
          self.run_command(cmd)
        File "C:\Users\dobbob11\AppData\Local\Temp\pip-build-env-brjy816p\overlay\Lib\site-packages\setuptools\dist.py", line 968, in run_command
          super().run_command(command)
        File "C:\Users\dobbob11\AppData\Local\Temp\pip-build-env-brjy816p\overlay\Lib\site-packages\setuptools\_distutils\dist.py", line 988, in run_command
          cmd_obj.run()
        File "C:\Users\dobbob11\AppData\Local\Temp\pip-build-env-brjy816p\overlay\Lib\site-packages\setuptools\command\egg_info.py", line 321, in run
          self.find_sources()
        File "C:\Users\dobbob11\AppData\Local\Temp\pip-build-env-brjy816p\overlay\Lib\site-packages\setuptools\command\egg_info.py", line 329, in find_sources
          mm.run()
        File "C:\Users\dobbob11\AppData\Local\Temp\pip-build-env-brjy816p\overlay\Lib\site-packages\setuptools\command\egg_info.py", line 550, in run
          self.add_defaults()
        File "C:\Users\dobbob11\AppData\Local\Temp\pip-build-env-brjy816p\overlay\Lib\site-packages\setuptools\command\egg_info.py", line 588, in add_defaults
          sdist.add_defaults(self)
        File "C:\Users\dobbob11\AppData\Local\Temp\pip-build-env-brjy816p\overlay\Lib\site-packages\setuptools\command\sdist.py", line 102, in add_defaults
          super().add_defaults()
        File "C:\Users\dobbob11\AppData\Local\Temp\pip-build-env-brjy816p\overlay\Lib\site-packages\setuptools\_distutils\command\sdist.py", line 250, in add_defaults
          self._add_defaults_ext()
        File "C:\Users\dobbob11\AppData\Local\Temp\pip-build-env-brjy816p\overlay\Lib\site-packages\setuptools\_distutils\command\sdist.py", line 335, in _add_defaults_ext
          self.filelist.extend(build_ext.get_source_files())
                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "<string>", line 201, in get_source_files
        File "C:\Users\dobbob11\AppData\Local\Temp\pip-build-env-brjy816p\overlay\Lib\site-packages\setuptools\_distutils\cmd.py", line 107, in __getattr__
          raise AttributeError(attr)
      AttributeError: cython_sources
      [end of output]
python pip pyyaml
1个回答
0
投票

该问题似乎与安装 yotta 时的 PyYAML 依赖关系有关。 首先阅读整个答案。然后尝试以下操作。

首先,尝试单独安装 PyYAML 以确保其安装正确:

pip install pyyaml==5.4.1

成功安装 PyYAML 后,尝试再次安装 yotta。

pip install -U yotta

如果它不适合你,那么创建一个虚拟环境并激活它:

python -m venv yotta-env
yotta-env\Scripts\activate

升级 pip 和 setuptools:

pip install --upgrade pip setuptools

安装yotta:

pip install -U yotta

确保您拥有 Python 所需的所有构建工具。在 Windows 上,这通常意味着安装 Visual Studio 构建工具。

您可以使用以下方式安装它们:

pip install --upgrade setuptools wheel

但是,如果仍然存在问题,请尝试指定错误消息中所示的依赖项的确切版本。

祝你好运!

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