Python教程

python安装pywebview报错

本文主要是介绍python安装pywebview报错,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!
PS F:\python\TeaTerm> python -m pip install -i https://pypi.tuna.tsinghua.edu.cn/simple/ pywebview
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple/
Collecting pywebview
  Using cached https://pypi.tuna.tsinghua.edu.cn/packages/47/94/90d0728146aaec49b25a13578a53dc39bc578cbfd9105426688220ac6a09/pywebview-3.6.3-py3-none-any.whl (351 kB)
Collecting pythonnet
  Using cached https://pypi.tuna.tsinghua.edu.cn/packages/f7/18/be276f27f649199563a59561623c0c008e72bbcb6ecb8b2ca0404a741ae1/pythonnet-2.5.2.tar.gz (1.9 MB)
  Preparing metadata (setup.py) ... done
Requirement already satisfied: proxy-tools in f:\python\teaterm\venv\lib\site-packages (from pywebview) (0.1.0)
Requirement already satisfied: pycparser in f:\python\teaterm\venv\lib\site-packages (from pythonnet->pywebview) (2.21)
Building wheels for collected packages: pythonnet
  Building wheel for pythonnet (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py bdist_wheel did not run successfully.
  │ exit code: 1
  ╰─> [96 lines of output]
      running bdist_wheel
      running build
      running build_ext
      正在检查来自 https://www.nuget.org/api/v2/ 的更新。
      当前正在运行 NuGet.exe 4.1.0。
      正在将 NuGet.exe 更新到 6.1.0。
      更新成功。
      Cannot find the specified version of msbuild: '14'
      MSBuild auto-detection: using msbuild version '4.0' from 'C:\Windows\Microsoft.NET\Framework64\v4.0.30319'.
      C:\Users\Elysion\AppData\Local\Temp\NuGetScratch\wqydy0gs.pcf.nugetrestore.targets(459,20): error MSB4086: 尝试在条件“'$(MSBuildAssemblyVersion)' < '15.0'”中对计算结果为“”而不是数字的“$(MSBuildAssemblyVersion)”进行数值比较。 [C:\Users\Elysion\AppData\Local\Temp\pip-install-90rsm0m0\pythonnet_6df6eee606a643f98aab5c1020fc4bce\src\runtime\Python.Runtime.csproj]
      C:\Users\Elysion\AppData\Local\Temp\NuGetScratch\wqydy0gs.pcf.nugetrestore.targets(459,20): error MSB4086: 尝试在条件“'$(MSBuildAssemblyVersion)' < '15.0'”中对计算结果为“”而不是数字的“$(MSBuildAssemblyVersion)”进行数值比较。 [C:\Users\Elysion\AppData\Local\Temp\pip-install-90rsm0m0\pythonnet_6df6eee606a643f98aab5c1020fc4bce\src\testing\Python.Test.csproj]
      C:\Users\Elysion\AppData\Local\Temp\NuGetScratch\wqydy0gs.pcf.nugetrestore.targets(459,20): error MSB4086: 尝试在条件“'$(MSBuildAssemblyVersion)' < '15.0'”中对计算结果为“”而不是数字的“$(MSBuildAssemblyVersion)”进行数值比较。 [C:\Users\Elysion\AppData\Local\Temp\pip-install-90rsm0m0\pythonnet_6df6eee606a643f98aab5c1020fc4bce\src\embed_tests\Python.EmbeddingTest.csproj]
      C:\Users\Elysion\AppData\Local\Temp\NuGetScratch\wqydy0gs.pcf.nugetrestore.targets(459,20): error MSB4086: 尝试在条件“'$(MSBuildAssemblyVersion)' < '15.0'”中对计算结果为“”而不是数字的“$(MSBuildAssemblyVersion)”进行数值比较。 [C:\Users\Elysion\AppData\Local\Temp\pip-install-90rsm0m0\pythonnet_6df6eee606a643f98aab5c1020fc4bce\src\console\Console.csproj]
      C:\Users\Elysion\AppData\Local\Temp\NuGetScratch\wqydy0gs.pcf.nugetrestore.targets(459,20): error MSB4086: 尝试在条件“'$(MSBuildAssemblyVersion)' < '15.0'”中对计算结果为“”而不是数字的“$(MSBuildAssemblyVersion)”进行数值比较。 [C:\Users\Elysion\AppData\Local\Temp\pip-install-90rsm0m0\pythonnet_6df6eee606a643f98aab5c1020fc4bce\src\clrmodule\clrmodule.csproj]

      警告: Error reading msbuild project information, ensure that your input solution or project file is valid. NETCore and UAP projects will be skipped, only packages.config files will be restored.
      Restoring NuGet package System.ValueTuple.4.5.0.
      Restoring NuGet package NUnit.ConsoleRunner.3.11.1.
      Restoring NuGet package UnmanagedExports.1.2.7.
      Restoring NuGet package NUnit.3.12.0.
      Adding package 'NUnit.ConsoleRunner.3.11.1' to folder 'C:\Users\Elysion\AppData\Local\Temp\pip-install-90rsm0m0\pythonnet_6df6eee606a643f98aab5c1020fc4bce\packages'
      Adding package 'NUnit.3.12.0' to folder 'C:\Users\Elysion\AppData\Local\Temp\pip-install-90rsm0m0\pythonnet_6df6eee606a643f98aab5c1020fc4bce\packages'
      Adding package 'UnmanagedExports.1.2.7' to folder 'C:\Users\Elysion\AppData\Local\Temp\pip-install-90rsm0m0\pythonnet_6df6eee606a643f98aab5c1020fc4bce\packages'
      Adding package 'System.ValueTuple.4.5.0' to folder 'C:\Users\Elysion\AppData\Local\Temp\pip-install-90rsm0m0\pythonnet_6df6eee606a643f98aab5c1020fc4bce\packages'
      Added package 'UnmanagedExports.1.2.7' to folder 'C:\Users\Elysion\AppData\Local\Temp\pip-install-90rsm0m0\pythonnet_6df6eee606a643f98aab5c1020fc4bce\packages'
      Added package 'NUnit.ConsoleRunner.3.11.1' to folder 'C:\Users\Elysion\AppData\Local\Temp\pip-install-90rsm0m0\pythonnet_6df6eee606a643f98aab5c1020fc4bce\packages'
      Added package 'System.ValueTuple.4.5.0' to folder 'C:\Users\Elysion\AppData\Local\Temp\pip-install-90rsm0m0\pythonnet_6df6eee606a643f98aab5c1020fc4bce\packages'
      Added package 'NUnit.3.12.0' to folder 'C:\Users\Elysion\AppData\Local\Temp\pip-install-90rsm0m0\pythonnet_6df6eee606a643f98aab5c1020fc4bce\packages'

      NuGet Config files used:
          C:\Users\Elysion\AppData\Roaming\NuGet\NuGet.Config

      Feeds used:
          C:\Users\Elysion\.nuget\packages\
          https://api.nuget.org/v3/index.json

      Installed:
          4 package(s) to packages.config projects
      Traceback (most recent call last):
        File "C:\Users\Elysion\AppData\Local\Temp\pip-install-90rsm0m0\pythonnet_6df6eee606a643f98aab5c1020fc4bce\tools\geninterop\geninterop.py", line 396, in <module>
          sys.exit(main())
        File "C:\Users\Elysion\AppData\Local\Temp\pip-install-90rsm0m0\pythonnet_6df6eee606a643f98aab5c1020fc4bce\tools\geninterop\geninterop.py", line 357, in main
          python_h = preprocess_python_headers()
        File "C:\Users\Elysion\AppData\Local\Temp\pip-install-90rsm0m0\pythonnet_6df6eee606a643f98aab5c1020fc4bce\tools\geninterop\geninterop.py", line 238, in preprocess_python_headers
          for line in _check_output(cmd).splitlines():
        File "C:\Users\Elysion\AppData\Local\Temp\pip-install-90rsm0m0\pythonnet_6df6eee606a643f98aab5c1020fc4bce\tools\geninterop\geninterop.py", line 46, in _check_output
          output = subprocess.check_output(*args, **kwargs)
        File "C:\Users\Elysion\AppData\Local\Programs\Python\Python310\lib\subprocess.py", line 420, in check_output
          return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
        File "C:\Users\Elysion\AppData\Local\Programs\Python\Python310\lib\subprocess.py", line 501, in run
          with Popen(*popenargs, **kwargs) as process:
        File "C:\Users\Elysion\AppData\Local\Programs\Python\Python310\lib\subprocess.py", line 966, in __init__
          self._execute_child(args, executable, preexec_fn, close_fds,
        File "C:\Users\Elysion\AppData\Local\Programs\Python\Python310\lib\subprocess.py", line 1435, in _execute_child
          hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
      FileNotFoundError: [WinError 2] 系统找不到指定的文件。
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "C:\Users\Elysion\AppData\Local\Temp\pip-install-90rsm0m0\pythonnet_6df6eee606a643f98aab5c1020fc4bce\setup.py", line 630, in <module>
          setup(
        File "F:\python\TeaTerm\venv\lib\site-packages\setuptools\__init__.py", line 155, in setup
          return distutils.core.setup(**attrs)
        File "F:\python\TeaTerm\venv\lib\site-packages\setuptools\_distutils\core.py", line 148, in setup
          return run_commands(dist)
        File "F:\python\TeaTerm\venv\lib\site-packages\setuptools\_distutils\core.py", line 163, in run_commands
          dist.run_commands()
        File "F:\python\TeaTerm\venv\lib\site-packages\setuptools\_distutils\dist.py", line 967, in run_commands
          self.run_command(cmd)
        File "F:\python\TeaTerm\venv\lib\site-packages\setuptools\_distutils\dist.py", line 986, in run_command
          cmd_obj.run()
        File "C:\Users\Elysion\AppData\Local\Temp\pip-install-90rsm0m0\pythonnet_6df6eee606a643f98aab5c1020fc4bce\setup.py", line 612, in run
          return bdist_wheel.bdist_wheel.run(self)
        File "F:\python\TeaTerm\venv\lib\site-packages\wheel\bdist_wheel.py", line 299, in run
          self.run_command('build')
        File "F:\python\TeaTerm\venv\lib\site-packages\setuptools\_distutils\cmd.py", line 313, in run_command
          self.distribution.run_command(command)
        File "F:\python\TeaTerm\venv\lib\site-packages\setuptools\_distutils\dist.py", line 986, in run_command
          cmd_obj.run()
        File "F:\python\TeaTerm\venv\lib\site-packages\setuptools\_distutils\command\build.py", line 135, in run
          self.run_command(cmd_name)
        File "F:\python\TeaTerm\venv\lib\site-packages\setuptools\_distutils\cmd.py", line 313, in run_command
          self.distribution.run_command(command)
        File "F:\python\TeaTerm\venv\lib\site-packages\setuptools\_distutils\dist.py", line 986, in run_command
          cmd_obj.run()
        File "F:\python\TeaTerm\venv\lib\site-packages\setuptools\_distutils\command\build_ext.py", line 339, in run
          self.build_extensions()
        File "F:\python\TeaTerm\venv\lib\site-packages\setuptools\_distutils\command\build_ext.py", line 448, in build_extensions
          self._build_extensions_serial()
        File "F:\python\TeaTerm\venv\lib\site-packages\setuptools\_distutils\command\build_ext.py", line 473, in _build_extensions_serial
          self.build_extension(ext)
        File "C:\Users\Elysion\AppData\Local\Temp\pip-install-90rsm0m0\pythonnet_6df6eee606a643f98aab5c1020fc4bce\setup.py", line 302, in build_extension
          subprocess.check_call([sys.executable, geninterop, interop_file])
        File "C:\Users\Elysion\AppData\Local\Programs\Python\Python310\lib\subprocess.py", line 369, in check_call
          raise CalledProcessError(retcode, cmd)
      subprocess.CalledProcessError: Command '['F:\\python\\TeaTerm\\venv\\Scripts\\python.exe', 'tools\\geninterop\\geninterop.py', 'src\\runtime\\interop310.cs']' returned non-zero exit status 1.
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for pythonnet
  Running setup.py clean for pythonnet
Failed to build pythonnet
Installing collected packages: pythonnet, pywebview
  Running setup.py install for pythonnet ... error
  error: subprocess-exited-with-error

  × Running setup.py install for pythonnet did not run successfully.
  │ exit code: 1
  ╰─> [6 lines of output]
      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
      [end of output]

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

× Encountered error while trying to install package.
╰─> pythonnet

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

  找了各种方法都不行,之后去pypi查看这个包发现只支持python3.8以下,这里用的python3.10所以会报错

0 更换3.8安装包之后一次安装成功 0
这篇关于python安装pywebview报错的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!