在执行pip安装pywebview时遇到了这个错误,我想在python中查看一个网页而不使用外部浏览器.
C:\Users\anik4\Desktop\New folder\Website Blocker> pip install pywebview
Collecting pywebview
Using cached pywebview-3.6.3-py3-none-any.whl (351 kB)
Collecting pythonnet
Using cached pythonnet-2.5.2.tar.gz (1.9 MB)
Preparing metadata (setup.py) ... done
Requirement already satisfied: proxy-tools in c:\users\anik4\appdata\local\programs\python\python310\lib\site-packages (from pywebview) (0.1.0)
Requirement already satisfied: pycparser in c:\users\anik4\appdata\local\programs\python\python310\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
╰─> [104 lines of output]
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.3.0.
Update successful.
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\anik4\AppData\Local\Temp\NuGetScratch\vcolbnzs.pl2.nugetrestore.targets(539,20): error MSB4086: A numeric comparison was attempted on "$(MSBuildAssemblyVersion)" that
evaluates to "" instead of a number, in condition "'$(MSBuildAssemblyVersion)' < '15.0'". [C:\Users\anik4\AppData\Local\Temp\pip-install-d8wxkf3e\pythonnet_dd7fee9480cf4e57afd5dfe60886bc32\src\runtime\Python.Runtime.csproj]
C:\Users\anik4\AppData\Local\Temp\NuGetScratch\vcolbnzs.pl2.nugetrestore.targets(539,20): error MSB4086: A numeric comparison was attempted on "$(MSBuildAssemblyVersion)" that
evaluates to "" instead of a number, in condition "'$(MSBuildAssemblyVersion)' < '15.0'". [C:\Users\anik4\AppData\Local\Temp\pip-install-d8wxkf3e\pythonnet_dd7fee9480cf4e57afd5dfe60886bc32\src\testing\Python.Test.csproj]
C:\Users\anik4\AppData\Local\Temp\NuGetScratch\vcolbnzs.pl2.nugetrestore.targets(539,20): error MSB4086: A numeric comparison was attempted on "$(MSBuildAssemblyVersion)" that
evaluates to "" instead of a number, in condition "'$(MSBuildAssemblyVersion)' < '15.0'". [C:\Users\anik4\AppData\Local\Temp\pip-install-d8wxkf3e\pythonnet_dd7fee9480cf4e57afd5dfe60886bc32\src\embed_tests\Python.EmbeddingTest.csproj]
C:\Users\anik4\AppData\Local\Temp\NuGetScratch\vcolbnzs.pl2.nugetrestore.targets(539,20): error MSB4086: A numeric comparison was attempted on "$(MSBuildAssemblyVersion)" that
evaluates to "" instead of a number, in condition "'$(MSBuildAssemblyVersion)' < '15.0'". [C:\Users\anik4\AppData\Local\Temp\pip-install-d8wxkf3e\pythonnet_dd7fee9480cf4e57afd5dfe60886bc32\src\console\Console.csproj]
C:\Users\anik4\AppData\Local\Temp\NuGetScratch\vcolbnzs.pl2.nugetrestore.targets(539,20): error MSB4086: A numeric comparison was attempted on "$(MSBuildAssemblyVersion)" that
evaluates to "" instead of a number, in condition "'$(MSBuildAssemblyVersion)' < '15.0'". [C:\Users\anik4\AppData\Local\Temp\pip-install-d8wxkf3e\pythonnet_dd7fee9480cf4e57afd5dfe60886bc32\src\clrmodule\clrmodule.csproj]
WARNING: 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 UnmanagedExports.1.2.7.
Restoring NuGet package NUnit.ConsoleRunner.3.11.1.
Restoring NuGet package System.ValueTuple.4.5.0.
Restoring NuGet package NUnit.3.12.0.
Adding package 'System.ValueTuple.4.5.0' to folder 'C:\Users\anik4\AppData\Local\Temp\pip-install-d8wxkf3e\pythonnet_dd7fee9480cf4e57afd5dfe60886bc32\packages'
Adding package 'NUnit.3.12.0' to folder 'C:\Users\anik4\AppData\Local\Temp\pip-install-d8wxkf3e\pythonnet_dd7fee9480cf4e57afd5dfe60886bc32\packages'
Adding package 'UnmanagedExports.1.2.7' to folder 'C:\Users\anik4\AppData\Local\Temp\pip-install-d8wxkf3e\pythonnet_dd7fee9480cf4e57afd5dfe60886bc32\packages'
Adding package 'NUnit.ConsoleRunner.3.11.1' to folder 'C:\Users\anik4\AppData\Local\Temp\pip-install-d8wxkf3e\pythonnet_dd7fee9480cf4e57afd5dfe60886bc32\packages'
Added package 'UnmanagedExports.1.2.7' to folder 'C:\Users\anik4\AppData\Local\Temp\pip-install-d8wxkf3e\pythonnet_dd7fee9480cf4e57afd5dfe60886bc32\packages'
Added package 'NUnit.ConsoleRunner.3.11.1' to folder 'C:\Users\anik4\AppData\Local\Temp\pip-install-d8wxkf3e\pythonnet_dd7fee9480cf4e57afd5dfe60886bc32\packages'
Added package 'System.ValueTuple.4.5.0' to folder 'C:\Users\anik4\AppData\Local\Temp\pip-install-d8wxkf3e\pythonnet_dd7fee9480cf4e57afd5dfe60886bc32\packages'
Added package 'NUnit.3.12.0' to folder 'C:\Users\anik4\AppData\Local\Temp\pip-install-d8wxkf3e\pythonnet_dd7fee9480cf4e57afd5dfe60886bc32\packages'
NuGet Config files used:
C:\Users\anik4\AppData\Roaming\NuGet\NuGet.Config
Feeds used:
C:\Users\anik4\.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\anik4\AppData\Local\Temp\pip-install-d8wxkf3e\pythonnet_dd7fee9480cf4e57afd5dfe60886bc32\tools\geninterop\geninterop.py", line 396, in <module>
sys.exit(main())
File "C:\Users\anik4\AppData\Local\Temp\pip-install-d8wxkf3e\pythonnet_dd7fee9480cf4e57afd5dfe60886bc32\tools\geninterop\geninterop.py", line 357, in main
python_h = preprocess_python_headers()
File "C:\Users\anik4\AppData\Local\Temp\pip-install-d8wxkf3e\pythonnet_dd7fee9480cf4e57afd5dfe60886bc32\tools\geninterop\geninterop.py", line 238, in preprocess_python_headers
for line in _check_output(cmd).splitlines():
File "C:\Users\anik4\AppData\Local\Temp\pip-install-d8wxkf3e\pythonnet_dd7fee9480cf4e57afd5dfe60886bc32\tools\geninterop\geninterop.py", line 46, in _check_output
output = subprocess.check_output(*args, **kwargs)
File "C:\Users\anik4\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\anik4\AppData\Local\Programs\Python\Python310\lib\subprocess.py", line 501, in run
with Popen(*popenargs, **kwargs) as process:
File "C:\Users\anik4\AppData\Local\Programs\Python\Python310\lib\subprocess.py", line 969, in __init__
self._execute_child(args, executable, preexec_fn, close_fds,
File "C:\Users\anik4\AppData\Local\Programs\Python\Python310\lib\subprocess.py", line 1438, in _execute_child
hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
FileNotFoundError: [WinError 2] The system cannot find the file specified
Traceback (most recent call last):
File "<string>", line 2, in <module>
File "<pip-setuptools-caller>", line 34, in <module>
File "C:\Users\anik4\AppData\Local\Temp\pip-install-d8wxkf3e\pythonnet_dd7fee9480cf4e57afd5dfe60886bc32\setup.py", line 630, in <module>
setup(
File "C:\Users\anik4\AppData\Local\Programs\Python\Python310\lib\site-packages\setuptools\__init__.py", line 87, in setup
return distutils.core.setup(**attrs)
File "C:\Users\anik4\AppData\Local\Programs\Python\Python310\lib\site-packages\setuptools\_distutils\core.py", line 177, in setup
return run_commands(dist)
File "C:\Users\anik4\AppData\Local\Programs\Python\Python310\lib\site-packages\setuptools\_distutils\core.py", line 193, in run_commands
dist.run_commands()
File "C:\Users\anik4\AppData\Local\Programs\Python\Python310\lib\site-packages\setuptools\_distutils\dist.py", line 968, in run_commands
self.run_command(cmd)
File "C:\Users\anik4\AppData\Local\Programs\Python\Python310\lib\site-packages\setuptools\dist.py", line 1229, in run_command
super().run_command(command)
File "C:\Users\anik4\AppData\Local\Programs\Python\Python310\lib\site-packages\setuptools\_distutils\dist.py", line 987, in run_command
cmd_obj.run()
File "C:\Users\anik4\AppData\Local\Temp\pip-install-d8wxkf3e\pythonnet_dd7fee9480cf4e57afd5dfe60886bc32\setup.py", line 612, in run
return bdist_wheel.bdist_wheel.run(self)
File "C:\Users\anik4\AppData\Local\Programs\Python\Python310\lib\site-packages\wheel\bdist_wheel.py", line 299, in run
self.run_command('build')
File "C:\Users\anik4\AppData\Local\Programs\Python\Python310\lib\site-packages\setuptools\_distutils\cmd.py", line 317, in run_command
self.distribution.run_command(command)
File "C:\Users\anik4\AppData\Local\Programs\Python\Python310\lib\site-packages\setuptools\dist.py", line 1229, in run_command
super().run_command(command)
File "C:\Users\anik4\AppData\Local\Programs\Python\Python310\lib\site-packages\setuptools\_distutils\dist.py", line 987, in run_command
cmd_obj.run()
File "C:\Users\anik4\AppData\Local\Programs\Python\Python310\lib\site-packages\setuptools\command\build.py", line 24, in run
super().run()
File "C:\Users\anik4\AppData\Local\Programs\Python\Python310\lib\site-packages\setuptools\_distutils\command\build.py", line 131, in run
self.run_command(cmd_name)
File "C:\Users\anik4\AppData\Local\Programs\Python\Python310\lib\site-packages\setuptools\_distutils\cmd.py", line 317, in run_command
self.distribution.run_command(command)
File "C:\Users\anik4\AppData\Local\Programs\Python\Python310\lib\site-packages\setuptools\dist.py", line 1229, in run_command
super().run_command(command)
File "C:\Users\anik4\AppData\Local\Programs\Python\Python310\lib\site-packages\setuptools\_distutils\dist.py", line 987, in run_command
cmd_obj.run()
File "C:\Users\anik4\AppData\Local\Programs\Python\Python310\lib\site-packages\setuptools\_distutils\command\build_ext.py", line 339, in run
self.build_extensions()
File "C:\Users\anik4\AppData\Local\Programs\Python\Python310\lib\site-packages\setuptools\_distutils\command\build_ext.py", line 459, in build_extensions
self._build_extensions_serial()
File "C:\Users\anik4\AppData\Local\Programs\Python\Python310\lib\site-packages\setuptools\_distutils\command\build_ext.py", line 485, in _build_extensions_serial
self.build_extension(ext)
File "C:\Users\anik4\AppData\Local\Temp\pip-install-d8wxkf3e\pythonnet_dd7fee9480cf4e57afd5dfe60886bc32\setup.py", line 302, in build_extension
subprocess.check_call([sys.executable, geninterop, interop_file])
File "C:\Users\anik4\AppData\Local\Programs\Python\Python310\lib\subprocess.py", line 369, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['C:\\Users\\anik4\\AppData\\Local\\Programs\\Python\\Python310\\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.我如何对付它呢?,Python3.8,windows 10,计算机用户:下面的文本只是传递堆栈溢出错误--错误看起来是错误,但不是错误,或者是错误,错误是错误,但行为、行走和嘎嘎就像错误,而不是错误。
发布于 2022-09-21 08:46:34
PyWebView将PythonNET作为依赖项,这是导致问题的原因之一。
您使用的是Python 3.__10。
首先,您应该像在PythonNET中描述的那样安装[SO]: How to fix error during pythonnet installation (@CristiFati's answer) (我移动了这个答案的大部分原始版本),然后才安装PyWebView (在搜索依赖项时,它将看到它已经安装,并且不再试图安装它)。
由于PyWebView不需要特定的PythonNET版本,所以这应该可以工作(理论上,如果它们保持API (接口)向后兼容)。
注意到,与PythonNet相关的所有东西也可以应用于其他依赖项(递归)。
https://stackoverflow.com/questions/73796372
复制相似问题