我确实从 https://www.microsoft.com/en-US/download/details.aspx?id=48159 安装了 Buildtools 14.0
尽管在运行 pip install pythonnet
时出现以下错误
Building wheels for collected packages: pythonnet
Building wheel for pythonnet (setup.py) ... error
ERROR: Command errored out with exit status 1:
command: 'C:\Users\hp\AppData\Local\Microsoft\WindowsApps\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\hp\\AppData\\Local\\Temp\\pip-install-amjmb8gg\\pythonnet_b0ee90a637684c0b8f0befb4cdf6d786\\setup.py'"'"'; __file__='"'"'C:\\Users\\hp\\AppData\\Local\\Temp\\pip-install-amjmb8gg\\pythonnet_b0ee90a637684c0b8f0befb4cdf6d786\\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\hp\AppData\Local\Temp\pip-wheel-zu_me3rf'
cwd: C:\Users\hp\AppData\Local\Temp\pip-install-amjmb8gg\pythonnet_b0ee90a637684c0b8f0befb4cdf6d786\
Complete output (31 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 5.9.1.
Update successful.
MSBuild auto-detection: using msbuild version '14.0' from 'C:\Program Files (x86)\MSBuild\14.0\bin\amd64'.
Restoring NuGet package UnmanagedExports.1.2.7.
Restoring NuGet package System.ValueTuple.4.5.0.
Restoring NuGet package NUnit.ConsoleRunner.3.11.1.
Restoring NuGet package NUnit.3.12.0.
Adding package 'UnmanagedExports.1.2.7' to folder 'C:\Users\hp\AppData\Local\Temp\pip-install-amjmb8gg\pythonnet_b0ee90a637684c0b8f0befb4cdf6d786\packages'
Adding package 'NUnit.ConsoleRunner.3.11.1' to folder 'C:\Users\hp\AppData\Local\Temp\pip-install-amjmb8gg\pythonnet_b0ee90a637684c0b8f0befb4cdf6d786\packages'
Adding package 'System.ValueTuple.4.5.0' to folder 'C:\Users\hp\AppData\Local\Temp\pip-install-amjmb8gg\pythonnet_b0ee90a637684c0b8f0befb4cdf6d786\packages'
Adding package 'NUnit.3.12.0' to folder 'C:\Users\hp\AppData\Local\Temp\pip-install-amjmb8gg\pythonnet_b0ee90a637684c0b8f0befb4cdf6d786\packages'
Added package 'UnmanagedExports.1.2.7' to folder 'C:\Users\hp\AppData\Local\Temp\pip-install-amjmb8gg\pythonnet_b0ee90a637684c0b8f0befb4cdf6d786\packages'
Added package 'NUnit.ConsoleRunner.3.11.1' to folder 'C:\Users\hp\AppData\Local\Temp\pip-install-amjmb8gg\pythonnet_b0ee90a637684c0b8f0befb4cdf6d786\packages'
Added package 'System.ValueTuple.4.5.0' to folder 'C:\Users\hp\AppData\Local\Temp\pip-install-amjmb8gg\pythonnet_b0ee90a637684c0b8f0befb4cdf6d786\packages'
Added package 'NUnit.3.12.0' to folder 'C:\Users\hp\AppData\Local\Temp\pip-install-amjmb8gg\pythonnet_b0ee90a637684c0b8f0befb4cdf6d786\packages'
NuGet Config files used:
C:\Users\hp\AppData\Roaming\NuGet\NuGet.Config
Feeds used:
C:\Users\hp\.nuget\packages\
https://api.nuget.org/v3/index.json
Installed:
4 package(s) to packages.config projects
error: [WinError 2] The system cannot find the file specified
----------------------------------------
ERROR: Failed building wheel for pythonnet
Running setup.py clean for pythonnet
Failed to build pythonnet
Installing collected packages: pythonnet, sortedcontainers, robotframework-pythonlibcore, requests-toolbelt, requests-file, pywebview, PySocks, orderedmultidict, ntlm-auth, isodate, defusedxml, cryptography, cached-property, zeep, xlwt, xlrd, wrapt, tzlocal, tzdata, robotframework-seleniumlibrary, robocorp-dialog, rfc3987, requests-ntlm, pywin32, pypdf2, pygments, pdfminer.six, furl, fpdf2, et-xmlfile, dnspython, decorator, comtypes, click, authlib, xlutils, tweepy, simple-salesforce, rpaframework-pdf, rpaframework-dialogs, robotframework-seleniumtestability, robotframework-sapguilibrary, robotframework-requests, pyperclip, pynput-robocorp-fork, openpyxl, notifiers, netsuitesdk, mss, jsonpath-ng, java-access-bridge-wrapper, graphviz, exchangelib, docutils, rpaframework
Running setup.py install for pythonnet ... error
ERROR: Command errored out with exit status 1:
command: 'C:\Users\hp\AppData\Local\Microsoft\WindowsApps\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\hp\\AppData\\Local\\Temp\\pip-install-amjmb8gg\\pythonnet_b0ee90a637684c0b8f0befb4cdf6d786\\setup.py'"'"'; __file__='"'"'C:\\Users\\hp\\AppData\\Local\\Temp\\pip-install-amjmb8gg\\pythonnet_b0ee90a637684c0b8f0befb4cdf6d786\\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\hp\AppData\Local\Temp\pip-record-uv_7li22\install-record.txt' --single-version-externally-managed --user --prefix= --compile --install-headers 'C:\Users\hp\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\Include\pythonnet'
cwd: C:\Users\hp\AppData\Local\Temp\pip-install-amjmb8gg\pythonnet_b0ee90a637684c0b8f0befb4cdf6d786\
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\hp\AppData\Local\Microsoft\WindowsApps\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\hp\\AppData\\Local\\Temp\\pip-install-amjmb8gg\\pythonnet_b0ee90a637684c0b8f0befb4cdf6d786\\setup.py'"'"'; __file__='"'"'C:\\Users\\hp\\AppData\\Local\\Temp\\pip-install-amjmb8gg\\pythonnet_b0ee90a637684c0b8f0befb4cdf6d786\\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\hp\AppData\Local\Temp\pip-record-uv_7li22\install-record.txt' --single-version-externally-managed --user --prefix= --compile --install-headers 'C:\Users\hp\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\Include\pythonnet' Check the logs for full command output.
PS C:\Users\hp\Documents\Projects\LaunchTerminalTabs>
PS C:\Users\hp\Documents\Projects\LaunchTerminalTabs>
PS C:\Users\hp\Documents\Projects\LaunchTerminalTabs>
PS C:\Users\hp\Documents\Projects\LaunchTerminalTabs>
PS C:\Users\hp\Documents\Projects\LaunchTerminalTabs>
我也试过
pip install -U setuptools
pip install -U wheel
确保轮子更新
答案 0 :(得分:-1)
通过下载https://www.wheelodex.org/projects/pythonnet/wheels/pythonnet-2.5.2-cp38-cp38-win_amd64.whl解决
然后明确指定下载的wheel文件的完整路径:
pip install C:\Users\hp\Downloads\pythonnet-2.5.2-cp38-cp38-win_amd64.whl
注意默认的python版本应该与wheel文件名中的一样,你可以看到它是3.8