我试图在Visual Studio中安装opencv-python(已安装Visual Studio 2019),但不断出现此错误。我已经尝试过有关此PEP517错误的大多数以前发布的方法,但是我仍然遇到错误。如果我只是一个初学者,请感谢有人可以在这里帮助我。在此先感谢。
下面是错误代码:
$ pip install opencv-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
Requirement already satisfied: numpy>=1.17.3 in c:\python\lib\site-packages (from opencv-python) (1.19.2)
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:\python\python.exe' 'c:\python\lib\site-packages\pip\_vendor\pep517\_in_process.py' build_wheel 'C:\Users\Austen\AppData\Local\Temp\tmp6zo4yrsx'
cwd: C:\Users\Austen\AppData\Local\Temp\pip-install-tcb_5anh\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/Austen/AppData/Local/Temp/pip-install-tcb_5anh/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/Austen/AppData/Local/Temp/pip-install-tcb_5anh/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.
********************************************************************************
----------------------------------------
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
最佳答案
我已成功解决此错误问题。有两种解决方法,您可以使用其中一种:
干杯!
关于python - 错误:无法为使用PEP 517且无法直接安装的opencv-python构建轮子(在PATH中找不到cl),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64373381/