在 Windows 上安装 CPPYY 时出现 cmd 错误
Posted
技术标签:
【中文标题】在 Windows 上安装 CPPYY 时出现 cmd 错误【英文标题】:Error in cmd whlie installing CPPYY on windows 【发布时间】:2020-10-08 19:53:41 【问题描述】:我一直在尝试在我的计算机上安装Cppyy,但我是新手,所以我对此不太了解我在我的计算机上安装了 python 和 pip
C:\WINDOWS\system32>python --version
Python 3.8.6
C:\WINDOWS\system32> pip --version
pip 20.2.3
当我尝试运行时
点安装cppyy
cmd 给我错误
ERROR: Command errored out with exit status 1:
command: 'C:\Users\sarfaraz\AppData\Local\Microsoft\WindowsApps\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\python.exe' 'C:\Users\sarfaraz\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\pip' install --ignore-installed --no-user --prefix 'C:\Users\sarfaraz\AppData\Local\Temp\pip-build-env-z4gw8trb\overlay' --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- 'CPyCppyy==1.11.4; python_implementation != '"'"'PyPy'"'"'' 'cppyy-backend==1.14.0; python_implementation != '"'"'PyPy'"'"'' 'cppyy-cling==6.21.3; python_implementation != '"'"'PyPy'"'"'' 'cppyy-cling<=6.18.2.3; python_implementation == '"'"'PyPy'"'"'' setuptools wheel
cwd: None
Complete output (42 lines):
Ignoring cppyy-cling: markers 'platform_python_implementation == "PyPy"' don't match your environment
Collecting CPyCppyy==1.11.4
Using cached CPyCppyy-1.11.4.tar.gz (178 kB)
Installing build dependencies: started
Installing build dependencies: finished with status 'error'
ERROR: Command errored out with exit status 1:
command: 'C:\Users\sarfaraz\AppData\Local\Microsoft\WindowsApps\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\python.exe' 'C:\Users\sarfaraz\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\pip' install --ignore-installed --no-user --prefix 'C:\Users\sarfaraz\AppData\Local\Temp\pip-build-env-hj42_3n3\overlay' --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- 'cppyy-cling>=6.21.3' 'cppyy-backend>=1.14' setuptools wheel
cwd: None
Complete output (31 lines):
Collecting cppyy-cling>=6.21.3
Using cached cppyy_cling-6.21.3-py2.py3-none-win_amd64.whl (18.2 MB)
Collecting cppyy-backend>=1.14
Using cached cppyy-backend-1.14.0.tar.gz (32 kB)
Installing build dependencies: started
Installing build dependencies: finished with status 'done'
Getting requirements to build wheel: started
Getting requirements to build wheel: finished with status 'done'
Preparing wheel metadata: started
Preparing wheel metadata: finished with status 'done'
Collecting setuptools
Using cached setuptools-50.3.0-py3-none-any.whl (785 kB)
Collecting wheel
Using cached wheel-0.35.1-py2.py3-none-any.whl (33 kB)
Building wheels for collected packages: cppyy-backend
Building wheel for cppyy-backend (PEP 517): started
Building wheel for cppyy-backend (PEP 517): finished with status 'error'
ERROR: Command errored out with exit status 1:
command: 'C:\Users\sarfaraz\AppData\Local\Microsoft\WindowsApps\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\python.exe' 'C:\Users\sarfaraz\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\pip\_vendor\pep517\_in_process.py' build_wheel 'C:\Users\sarfaraz\AppData\Local\Temp\tmpojxb8d41'
cwd: C:\Users\sarfaraz\AppData\Local\Temp\pip-install-znkz3pmg\cppyy-backend
Complete output (6 lines):
running bdist_wheel
running build
running build_ext
checking for build\temp.win-amd64-3.8\Release
creating build\temp.win-amd64-3.8\Release
error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/
----------------------------------------
ERROR: Failed building wheel for cppyy-backend
Failed to build cppyy-backend
ERROR: Could not build wheels for cppyy-backend which use PEP 517 and cannot be installed directly
----------------------------------------
ERROR: Command errored out with exit status 1: 'C:\Users\sarfaraz\AppData\Local\Microsoft\WindowsApps\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\python.exe' 'C:\Users\sarfaraz\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\pip' install --ignore-installed --no-user --prefix 'C:\Users\sarfaraz\AppData\Local\Temp\pip-build-env-hj42_3n3\overlay' --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- 'cppyy-cling>=6.21.3' 'cppyy-backend>=1.14' setuptools wheel Check the logs for full command output.
----------------------------------------
ERROR: Command errored out with exit status 1: 'C:\Users\sarfaraz\AppData\Local\Microsoft\WindowsApps\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\python.exe' 'C:\Users\sarfaraz\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\pip' install --ignore-installed --no-user --prefix 'C:\Users\sarfaraz\AppData\Local\Temp\pip-build-env-z4gw8trb\overlay' --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- 'CPyCppyy==1.11.4; python_implementation != '"'"'PyPy'"'"'' 'cppyy-backend==1.14.0; python_implementation != '"'"'PyPy'"'"'' 'cppyy-cling==6.21.3; python_implementation != '"'"'PyPy'"'"'' 'cppyy-cling<=6.18.2.3; python_implementation == '"'"'PyPy'"'"'' setuptools wheel Check the logs for full command output.
我在网站上找到了一些说明,但我很难按照这些说明进行操作,因为我是新手
提前致谢
【问题讨论】:
setuptools ***安装了吗?error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/
应该是您的向导。如果没有安装 MSVC 编译器,cppyy
无论如何都没用。
是的 setuptools ***已安装
【参考方案1】:
尝试升级setuptools轮
pip install -U setuptools wheel
结束然后尝试
pip install cppyy --no-index
如果没有帮助,python 3.8 可能会出现这个问题 PyPi 支持
【讨论】:
对于 pip install -U setuptools wheel 要求已经是最新的:对于 pip install cppyy --no-index 错误:找不到满足要求 cppyy 的版本(来自版本:无)错误:没有为 cppyy 找到匹配的分布【参考方案2】:如错误消息中所示和 hoefling 已经提到的,您需要一个系统编译器,至少用于系统头文件,但也用于 C++ 库头文件。 Cling 需要这些头文件中的代码来解析您可能提供给它的使用 C++ 标准库或 Windows 系统功能的任何新 C++ 代码。
原则上,可以使用包含所有系统和 C++ 头文件的 cppyy-cling 预编译头文件作为 IR 位代码,但 MSVC 喜欢在版本之间更改头文件包含保护,因此仅 如果有没有系统编译器就可以工作。 (它在 Linux 上要好一些,但在某些情况下它也更改了包含保护名称。)一旦 Cling 在 Windows 上支持预编译模块(PCM;与头文件相对),就会重新审视这一点。然后,如果没有可用的系统编译器,可以有条件地预打包和安装这些 PCM。然而,上游的模块支持仍然很新鲜,甚至还没有发布,所以这只会在中期出现。
无论如何,MSVC 现在是免费的。 :)
【讨论】:
感谢您的回答。所以我想知道你想我在我的 Windows 上安装哪个版本的 MSVC,因为从这里“visualstudio.microsoft.com/visual-cpp-build-tools”下载后,这些选项有很多选项和很多版本。我确实安装了最新版本的 MSVC,但它仍然给我错误。我是新手,所以不太了解。 最新版本没问题,只要它包含 C++ 工具。接下来,您需要确保这些工具在您的环境中可用,方法是直接运行安装脚本,或者启动完成此操作的命令提示符。请参阅您引用的页面上的“演练”链接:docs.microsoft.com/en-us/cpp/build/…以上是关于在 Windows 上安装 CPPYY 时出现 cmd 错误的主要内容,如果未能解决你的问题,请参考以下文章
在 Windows 上安装 Node 包时出现 ETIMEDOUT 错误
在 Windows 10 上安装时,安装向导过早结束时出现 MongoDB 错误
在 Windows 10 上安装 Visual Studio 2015 时出现“安装程序包丢失或损坏”错误
在 Windows 10 上安装 SQL Server 2017 开发人员版时出现“糟糕”错误
在 Windows 上安装 Fabric(Python 库)时出现“错误:无法找到 vcvarsall.bat”[重复]