簡體   English   中英

錯誤:pythonnet 構建輪子失敗

[英]Error: Failed building wheel for pythonnet

我正在嘗試安裝pythonnet,但由於某種原因我無法安裝,每當我嘗試安裝它時它都會給我這個錯誤

pip3 install pythonnet
Collecting pythonnet
  Using cached pythonnet-2.5.2.tar.gz (1.9 MB)
  Preparing metadata (setup.py) ... done
Requirement already satisfied: pycparser in c:\users\0991t\appdata\local\packages\pythonsoftwarefoundation.python.3.9_qbz5n2kfra8p0\localcache\local-packages\python39\site-packages (from pythonnet) (2.20)
Building wheels for collected packages: pythonnet
  Building wheel for pythonnet (setup.py) ... error
ERROR: Command errored out with exit status 1:
   command: 'C:\Users\0991t\AppData\Local\Microsoft\WindowsApps\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\0991t\\AppData\\Local\\Temp\\pip-install-oqtzzy7u\\pythonnet_3e469843a44f4517b9f84bc86e79df93\\setup.py'"'"'; __file__='"'"'C:\\Users\\0991t\\AppData\\Local\\Temp\\pip-install-oqtzzy7u\\pythonnet_3e469843a44f4517b9f84bc86e79df93\\setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d 'C:\Users\0991t\AppData\Local\Temp\pip-wheel-u9mp60rw'
       cwd: C:\Users\0991t\AppData\Local\Temp\pip-install-oqtzzy7u\pythonnet_3e469843a44f4517b9f84bc86e79df93\
  Complete output (80 lines):
  running bdist_wheel
  running build
  running build_ext
  Checking for updates from https://www.nuget.org/api/v2/.
  Currently running NuGet.exe 4.1.0.
  Updating NuGet.exe to 6.0.0.
  Update successful.
  Cannot find the specified version of msbuild: '14'
  MSBuild auto-detection: using msbuild version '16.11.2.50704' from 'C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Current\bin'.
  Restoring NuGet package NUnit.ConsoleRunner.3.11.1.
  Restoring NuGet package NUnit.3.12.0.
  Restoring NuGet package System.ValueTuple.4.5.0.
  Restoring NuGet package UnmanagedExports.1.2.7.
  Adding package 'NUnit.3.12.0' to folder 'C:\Users\0991t\AppData\Local\Temp\pip-install-oqtzzy7u\pythonnet_3e469843a44f4517b9f84bc86e79df93\packages'
  Adding package 'NUnit.ConsoleRunner.3.11.1' to folder 'C:\Users\0991t\AppData\Local\Temp\pip-install-oqtzzy7u\pythonnet_3e469843a44f4517b9f84bc86e79df93\packages'
  Adding package 'UnmanagedExports.1.2.7' to folder 'C:\Users\0991t\AppData\Local\Temp\pip-install-oqtzzy7u\pythonnet_3e469843a44f4517b9f84bc86e79df93\packages'
  Adding package 'System.ValueTuple.4.5.0' to folder 'C:\Users\0991t\AppData\Local\Temp\pip-install-oqtzzy7u\pythonnet_3e469843a44f4517b9f84bc86e79df93\packages'
  Added package 'UnmanagedExports.1.2.7' to folder 'C:\Users\0991t\AppData\Local\Temp\pip-install-oqtzzy7u\pythonnet_3e469843a44f4517b9f84bc86e79df93\packages'
  Added package 'NUnit.ConsoleRunner.3.11.1' to folder 'C:\Users\0991t\AppData\Local\Temp\pip-install-oqtzzy7u\pythonnet_3e469843a44f4517b9f84bc86e79df93\packages'
  Added package 'System.ValueTuple.4.5.0' to folder 'C:\Users\0991t\AppData\Local\Temp\pip-install-oqtzzy7u\pythonnet_3e469843a44f4517b9f84bc86e79df93\packages'
  Added package 'NUnit.3.12.0' to folder 'C:\Users\0991t\AppData\Local\Temp\pip-install-oqtzzy7u\pythonnet_3e469843a44f4517b9f84bc86e79df93\packages'

  NuGet Config files used:
      C:\Users\0991t\AppData\Roaming\NuGet\NuGet.Config
      C:\Program Files (x86)\NuGet\Config\Microsoft.VisualStudio.Offline.config

  Feeds used:
      C:\Users\0991t\.nuget\packages\
      https://api.nuget.org/v3/index.json
      C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\

  Installed:
      4 package(s) to packages.config projects
  Microsoft (R) Manifest Tool

  Copyright (c) Microsoft Corporation.

  All rights reserved.

  Traceback (most recent call last):
    File "<string>", line 1, in <module>
    File "C:\Users\0991t\AppData\Local\Temp\pip-install-oqtzzy7u\pythonnet_3e469843a44f4517b9f84bc86e79df93\setup.py", line 630, in <module>
      setup(
    File "C:\Users\0991t\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\setuptools\__init__.py", line 155, in setup
      return distutils.core.setup(**attrs)
    File "C:\Users\0991t\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\setuptools\_distutils\core.py", line 148, in setup
      return run_commands(dist)
    File "C:\Users\0991t\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\setuptools\_distutils\core.py", line 163, in run_commands
      dist.run_commands()
    File "C:\Users\0991t\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\setuptools\_distutils\dist.py", line 967, in run_commands
      self.run_command(cmd)
    File "C:\Users\0991t\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\setuptools\_distutils\dist.py", line 986, in run_command
      cmd_obj.run()
    File "C:\Users\0991t\AppData\Local\Temp\pip-install-oqtzzy7u\pythonnet_3e469843a44f4517b9f84bc86e79df93\setup.py", line 612, in run
      return bdist_wheel.bdist_wheel.run(self)
    File "C:\Users\0991t\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\wheel\bdist_wheel.py", line 299, in run
      self.run_command('build')
    File "C:\Users\0991t\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\setuptools\_distutils\cmd.py", line 313, in run_command
      self.distribution.run_command(command)
    File "C:\Users\0991t\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\setuptools\_distutils\dist.py", line 986, in run_command
      cmd_obj.run()
    File "C:\Users\0991t\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\setuptools\_distutils\command\build.py", line 135, in run
      self.run_command(cmd_name)
    File "C:\Users\0991t\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\setuptools\_distutils\cmd.py", line 313, in run_command
      self.distribution.run_command(command)
    File "C:\Users\0991t\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\setuptools\_distutils\dist.py", line 986, in run_command
      cmd_obj.run()
    File "C:\Users\0991t\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\setuptools\_distutils\command\build_ext.py", line 339, in run
      self.build_extensions()
    File "C:\Users\0991t\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\setuptools\_distutils\command\build_ext.py", line 448, in build_extensions
      self._build_extensions_serial()
    File "C:\Users\0991t\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\setuptools\_distutils\command\build_ext.py", line 473, in _build_extensions_serial
      self.build_extension(ext)
    File "C:\Users\0991t\AppData\Local\Temp\pip-install-oqtzzy7u\pythonnet_3e469843a44f4517b9f84bc86e79df93\setup.py", line 345, in build_extension
      manifest = self._get_manifest(dest_dir)
    File "C:\Users\0991t\AppData\Local\Temp\pip-install-oqtzzy7u\pythonnet_3e469843a44f4517b9f84bc86e79df93\setup.py", line 389, in _get_manifest
      subprocess.check_call(" ".join(cmd), shell=False)
    File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.2544.0_x64__qbz5n2kfra8p0\lib\subprocess.py", line 373, in check_call
      raise CalledProcessError(retcode, cmd)
  subprocess.CalledProcessError: Command 'C:\Program Files (x86)\Windows Kits\10\bin\10.0.19041.0\x64\mt.exe -inputresource:"C:\Users\0991t\AppData\Local\Microsoft\WindowsApps\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\python.exe" -out:"C:\Users\0991t\AppData\Local\Temp\pip-install-oqtzzy7u\pythonnet_3e469843a44f4517b9f84bc86e79df93\build\lib.win-amd64-3.9\app.manifest"' returned non-zero exit status 31.
  ----------------------------------------
  ERROR: Failed building wheel for pythonnet
  Running setup.py clean for pythonnet
Failed to build pythonnet
Installing collected packages: pythonnet
    Running setup.py install for pythonnet ... error
    ERROR: Command errored out with exit status 1:
     command: 'C:\Users\0991t\AppData\Local\Microsoft\WindowsApps\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\0991t\\AppData\\Local\\Temp\\pip-install-oqtzzy7u\\pythonnet_3e469843a44f4517b9f84bc86e79df93\\setup.py'"'"'; __file__='"'"'C:\\Users\\0991t\\AppData\\Local\\Temp\\pip-install-oqtzzy7u\\pythonnet_3e469843a44f4517b9f84bc86e79df93\\setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\0991t\AppData\Local\Temp\pip-record-l9hhufpc\install-record.txt' --single-version-externally-managed --user --prefix= --compile --install-headers 'C:\Users\0991t\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\Include\pythonnet'
         cwd: C:\Users\0991t\AppData\Local\Temp\pip-install-oqtzzy7u\pythonnet_3e469843a44f4517b9f84bc86e79df93\
    Complete output (6 lines):
    usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
       or: setup.py --help [cmd1 cmd2 ...]
       or: setup.py --help-commands
       or: setup.py cmd --help

    error: option --single-version-externally-managed not recognized
    ----------------------------------------
ERROR: Command errored out with exit status 1: 'C:\Users\0991t\AppData\Local\Microsoft\WindowsApps\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\0991t\\AppData\\Local\\Temp\\pip-install-oqtzzy7u\\pythonnet_3e469843a44f4517b9f84bc86e79df93\\setup.py'"'"'; __file__='"'"'C:\\Users\\0991t\\AppData\\Local\\Temp\\pip-install-oqtzzy7u\\pythonnet_3e469843a44f4517b9f84bc86e79df93\\setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\0991t\AppData\Local\Temp\pip-record-l9hhufpc\install-record.txt' --single-version-externally-managed --user --prefix= --compile --install-headers 'C:\Users\0991t\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\Include\pythonnet' Check the logs for full command output.

我已經嘗試更新 setuptools、pip 和 wheel。 我已經嘗試了很多東西,但我無法理解為什么它會導致這個錯誤。 我正在使用最新的 pip 版本並使用最新的 python 版本。 我還使用最新的 setuptools 版本和最新的 wheel 版本。 抱歉,我試圖讓我的問題主要不是代碼,所以我實際上可以發布它,哈哈。

這可以幫助你@Thomas。

我有同樣的問題,這解決了我的問題並成功安裝。

由於pythonnet版本不匹配 python 3.10.1 報此錯誤。

Go 至: https://pypi.org/project/pythonnet/

然后按照以下步驟操作:

  1. 打開官網:pythonnet。

  2. 點擊“下載文件”。

  3. 然后下載“pythonnet-2.5.2-cp38-cp38-win_amd64.whl”(適用於64位python版本)

  4. 修改文件名如下: 之前:pythonnet-2.5.2-cp38-cp38-win_amd64.whl 之后:pythonnet-2.5.2-cp310-none-any.whl

  5. 現在嘗試安裝:pip 文件的安裝路徑,例如:pip 安裝 C:\users\user5\desktop\pythonnet-2.5。

我希望這對你有幫助。 一切順利。

原帖: https://www.codestudyblog.com/cs2112pyc/1221121223.html

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM