gpt4 book ai didi

python - 无法在 Windows 上安装 opencv-python

转载 作者:行者123 更新时间:2023-12-02 16:11:27 25 4
gpt4 key购买 nike

这个问题在这里已经有了答案:





Installing numpy with pip on windows 10 for python 3.7

(4 个回答)


1年前关闭。




然:pip install opencv-python
从带有管理员的 Windows cmd。
第一次设置python,我认为它没有使用正确的环境变量
收到此错误:

Collecting opencv-python
Using cached opencv-python-4.4.0.44.tar.gz (88.9 MB)
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing wheel metadata ... done
Processing c:\users\shub\appdata\local\pip\cache\wheels\a3\17\dd\f2dba23a35bb6008732772ccfb13d3d0e537fbc6919ce6862b\numpy-1.19.2-cp39-cp39-win_amd64.whl
Building wheels for collected packages: opencv-python
Building wheel for opencv-python (PEP 517) ... error
ERROR: Command errored out with exit status 1:
command: 'c:\users\shub\appdata\local\programs\python\python39\python.exe' 'c:\users\shub\appdata\local\programs\python\python39\lib\site-packages\pip\_vendor\pep517\_in_process.py' build_wheel 'C:\Users\Shub\AppData\Local\Temp\tmpmlx70j_s'
cwd: C:\Users\Shub\AppData\Local\Temp\pip-install-tdd7o170\opencv-python
Complete output (153 lines):
Not searching for unused variables given on the command line.
CMake Error: CMake was unable to find a build program corresponding to "Ninja". CMAKE_MAKE_PROGRAM is not set. You probably need to select a different build tool.
-- Configuring incomplete, errors occurred!
See also "C:/Users/Shub/AppData/Local/Temp/pip-install-tdd7o170/opencv-python/_cmake_test_compile/build/CMakeFiles/CMakeOutput.log".
Not searching for unused variables given on the command line.
CMake Error at CMakeLists.txt:2 (PROJECT):
Generator

Visual Studio 15 2017 Win64

could not find any instance of Visual Studio.



-- Configuring incomplete, errors occurred!
See also "C:/Users/Shub/AppData/Local/Temp/pip-install-tdd7o170/opencv-python/_cmake_test_compile/build/CMakeFiles/CMakeOutput.log".
Not searching for unused variables given on the command line.
-- The C compiler identification is unknown
CMake Error at CMakeLists.txt:3 (ENABLE_LANGUAGE):
The CMAKE_C_COMPILER:

cl

is not a full path and was not found in the PATH.

To use the NMake generator with Visual C++, cmake must be run from a shell
that can use the compiler cl from the command line. This environment is
unable to invoke the cl compiler. To fix this problem, run cmake from the
Visual Studio Command Prompt (vcvarsall.bat).

Tell CMake where to find the compiler by setting either the environment
variable "CC" or the CMake cache entry CMAKE_C_COMPILER to the full path to
the compiler, or to the compiler name if it is in the PATH.


-- Configuring incomplete, errors occurred!
See also "C:/Users/Shub/AppData/Local/Temp/pip-install-tdd7o170/opencv-python/_cmake_test_compile/build/CMakeFiles/CMakeOutput.log".
See also "C:/Users/Shub/AppData/Local/Temp/pip-install-tdd7o170/opencv-python/_cmake_test_compile/build/CMakeFiles/CMakeError.log".
Not searching for unused variables given on the command line.
-- The C compiler identification is unknown
CMake Error at CMakeLists.txt:3 (ENABLE_LANGUAGE):
The CMAKE_C_COMPILER:

cl

is not a full path and was not found in the PATH.

To use the JOM generator with Visual C++, cmake must be run from a shell
that can use the compiler cl from the command line. This environment is
unable to invoke the cl compiler. To fix this problem, run cmake from the
Visual Studio Command Prompt (vcvarsall.bat).

Tell CMake where to find the compiler by setting either the environment
variable "CC" or the CMake cache entry CMAKE_C_COMPILER to the full path to
the compiler, or to the compiler name if it is in the PATH.


-- Configuring incomplete, errors occurred!
See also "C:/Users/Shub/AppData/Local/Temp/pip-install-tdd7o170/opencv-python/_cmake_test_compile/build/CMakeFiles/CMakeOutput.log".
See also "C:/Users/Shub/AppData/Local/Temp/pip-install-tdd7o170/opencv-python/_cmake_test_compile/build/CMakeFiles/CMakeError.log".


...

--------------------------------------------------------------------------------
-- Trying "NMake Makefiles JOM (Visual Studio 15 2017 Win64 v141)" generator
--------------------------------
---------------------------
----------------------
-----------------
------------
-------
--
--
-------
------------
-----------------
----------------------
---------------------------
--------------------------------
-- Trying "NMake Makefiles JOM (Visual Studio 15 2017 Win64 v141)" generator - failure
--------------------------------------------------------------------------------

********************************************************************************
scikit-build could not get a working generator for your system. Aborting build.

Building windows wheels for Python 3.9 requires Microsoft Visual Studio 2017.
Get it with "Visual Studio 2017":

https://visualstudio.microsoft.com/vs/

********************************************************************************
----------------------------------------
ERROR: Failed building wheel for opencv-python
Failed to build opencv-python
ERROR: Could not build wheels for opencv-python which use PEP 517 and cannot be installed directly

C:\Windows\system32>
我安装了 Visual Studio 2019,安装了 C++ 构建工具,以及 pip 和 Wheel,但由于某种原因它无法检测到 Visual Studio。安装后我也重新启动了计算机。
不知道如何解决

最佳答案

只是有完全相同的问题:D
对我来说,它可以转到 Visual Studio 安装程序,在 Visual Studio 版本中选择修改,然后安装“使用 C++ 进行桌面开发”
然后尝试再次安装

关于python - 无法在 Windows 上安装 opencv-python,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64252970/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com