赞
踩
1.pycharm里不会提示函数
一开始觉得这个问题不大,大不了自己手打函数,但是真正用下来才发现,自动补全真的是IDE里最“伟大”的功能之一,且只有opencv库里的函数不会提示,在网上搜了几个方法,先谈谈无效的。
(1)添加解释器路径
最后一行可以看到我已经添加了cv库的路径了,然而并没有什么变化
(2)修改init.py文件
在cv的init文件中添加这两行,然而实测也无效
最终找到一个有用的方法,那就是将cv版本降级。。。
在将4.6版本降为4.5之后,终于有提示了
所以还是先用着4.5版本吧,看看后续有没有什么其他办法解决再更新。。
2.OpenCV: FFMPEG: tag 0x47504a4d/'MJPG' is not supported with codec id 7 and format 'mp4 / MP4 (MPEG-4 Part 14)'
OpenCV: FFMPEG: fallback to use tag 0x7634706d/'mp4v'
此时无法正常打开视频
错误原因:
合成视频时,编码类型错误
解决方法:
实测第一种可以用,参考文章M2det问题:win10运行错误总结_callmeCassie的博客-CSDN博客
3.ModuleNotFoundError: No module named ‘skbuild’
参考这篇文章,ModuleNotFoundError: No module named ‘skbuild‘解决办法_月夜竹清的博客-CSDN博客
解决方法:
pip install scikit-build
此时又报错
Problem with the CMake installation, aborting build. CMake executable is cmake
解决方法:
pip install cmake
结果到这里仍然报错
- pip install opencv-python
- Collecting opencv-python
- Downloading https://files.pythonhosted.org/packages/40/93/655af887bafece2a655998f53b9bd21ad94b0627d81d44aef35c79f40de6/opencv-python-4.7.0.72.tar.gz (91.1MB)
- 100% |████████████████████████████████| 91.1MB 12kB/s
- Requirement already satisfied: numpy>=1.13.3 in d:\programdata\anaconda3\envs\pytorch_test\lib\site-packages (from opencv-python)
- Building wheels for collected packages: opencv-python
- Running setup.py bdist_wheel for opencv-python ... error
- Complete output from command D:\ProgramData\Anaconda3\envs\pytorch_test\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\ADMINI~1\\AppData\\Local\\Temp\\pip-build-2q8jwyor\\opencv-python\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d C:\Users\ADMINI~1\AppData\Local\Temp\tmp0jak8wsnpip-wheel- --python-tag cp36:
-
-
- --------------------------------------------------------------------------------
- -- Trying 'Ninja (Visual Studio 17 2022 x64 v143)' generator
- --------------------------------
- ---------------------------
- ----------------------
- -----------------
- ------------
- -------
- --
- Not searching for unused variables given on the command line.
- CMake Error at CMakeLists.txt:2 (PROJECT):
- Generator
-
- Ninja
-
- does not support platform specification, but platform
-
- x64
-
- was specified.
-
-
- -- Configuring incomplete, errors occurred!
- --
- -------
- ------------
- -----------------
- ----------------------
- ---------------------------
- --------------------------------
- -- Trying 'Ninja (Visual Studio 17 2022 x64 v143)' generator - failure
- --------------------------------------------------------------------------------
-
-
-
- --------------------------------------------------------------------------------
- -- Trying 'Visual Studio 17 2022 x64 v143' generator
- --------------------------------
- ---------------------------
- ----------------------
- -----------------
- ------------
- -------
- --
- Not searching for unused variables given on the command line.
- CMake Error at CMakeLists.txt:2 (PROJECT):
- Generator
-
- Visual Studio 17 2022
-
- could not find any instance of Visual Studio.
-
-
-
- -- Configuring incomplete, errors occurred!
- --
- -------
- ------------
- -----------------
- ----------------------
- ---------------------------
- --------------------------------
- -- Trying 'Visual Studio 17 2022 x64 v143' generator - failure
- --------------------------------------------------------------------------------
-
-
-
- --------------------------------------------------------------------------------
- -- Trying 'Ninja (Visual Studio 16 2019 x64 v142)' generator
- --------------------------------
- ---------------------------
- ----------------------
- -----------------
- ------------
- -------
- --
- Not searching for unused variables given on the command line.
- CMake Error at CMakeLists.txt:2 (PROJECT):
- Generator
-
- Ninja
-
- does not support platform specification, but platform
-
- x64
-
- was specified.
-
-
- -- Configuring incomplete, errors occurred!
- --
- -------
- ------------
- -----------------
- ----------------------
- ---------------------------
- --------------------------------
- -- Trying 'Ninja (Visual Studio 16 2019 x64 v142)' generator - failure
- --------------------------------------------------------------------------------
-
-
-
- --------------------------------------------------------------------------------
- -- Trying 'Visual Studio 16 2019 x64 v142' generator
- --------------------------------
- ---------------------------
- ----------------------
- -----------------
- ------------
- -------
- --
- Not searching for unused variables given on the command line.
- CMake Error at CMakeLists.txt:2 (PROJECT):
- Generator
-
- Visual Studio 16 2019
-
- could not find any instance of Visual Studio.
-
-
-
- -- Configuring incomplete, errors occurred!
- --
- -------
- ------------
- -----------------
- ----------------------
- ---------------------------
- --------------------------------
- -- Trying 'Visual Studio 16 2019 x64 v142' generator - failure
- --------------------------------------------------------------------------------
-
-
-
- --------------------------------------------------------------------------------
- -- Trying 'Ninja (Visual Studio 15 2017 x64 v141)' generator
- --------------------------------
- ---------------------------
- ----------------------
- -----------------
- ------------
- -------
- --
- Not searching for unused variables given on the command line.
- CMake Error at CMakeLists.txt:2 (PROJECT):
- Generator
-
- Ninja
-
- does not support platform specification, but platform
-
- x64
-
- was specified.
-
-
- -- Configuring incomplete, errors occurred!
- --
- -------
- ------------
- -----------------
- ----------------------
- ---------------------------
- --------------------------------
- -- Trying 'Ninja (Visual Studio 15 2017 x64 v141)' generator - failure
- --------------------------------------------------------------------------------
-
-
-
- --------------------------------------------------------------------------------
- -- Trying 'Visual Studio 15 2017 x64 v141' generator
- --------------------------------
- ---------------------------
- ----------------------
- -----------------
- ------------
- -------
- --
- Not searching for unused variables given on the command line.
- CMake Error at CMakeLists.txt:2 (PROJECT):
- Generator
-
- Visual Studio 15 2017
-
- could not find any instance of Visual Studio.
-
-
-
- -- Configuring incomplete, errors occurred!
- --
- -------
- ------------
- -----------------
- ----------------------
- ---------------------------
- --------------------------------
- -- Trying 'Visual Studio 15 2017 x64 v141' generator - failure
- --------------------------------------------------------------------------------
-
-
-
- --------------------------------------------------------------------------------
- -- Trying 'NMake Makefiles (Visual Studio 17 2022 x64 v143)' generator
- --------------------------------
- ---------------------------
- ----------------------
- -----------------
- ------------
- -------
- --
- Not searching for unused variables given on the command line.
- CMake Error at CMakeLists.txt:2 (PROJECT):
- Generator
-
- NMake Makefiles
-
- does not support platform specification, but platform
-
- x64
-
- was specified.
-
-
- -- Configuring incomplete, errors occurred!
- --
- -------
- ------------
- -----------------
- ----------------------
- ---------------------------
- --------------------------------
- -- Trying 'NMake Makefiles (Visual Studio 17 2022 x64 v143)' generator - failure
- --------------------------------------------------------------------------------
-
-
-
- --------------------------------------------------------------------------------
- -- Trying 'NMake Makefiles (Visual Studio 16 2019 x64 v142)' generator
- --------------------------------
- ---------------------------
- ----------------------
- -----------------
- ------------
- -------
- --
- Not searching for unused variables given on the command line.
- CMake Error at CMakeLists.txt:2 (PROJECT):
- Generator
-
- NMake Makefiles
-
- does not support platform specification, but platform
-
- x64
-
- was specified.
-
-
- -- Configuring incomplete, errors occurred!
- --
- -------
- ------------
- -----------------
- ----------------------
- ---------------------------
- --------------------------------
- -- Trying 'NMake Makefiles (Visual Studio 16 2019 x64 v142)' generator - failure
- --------------------------------------------------------------------------------
-
-
-
- --------------------------------------------------------------------------------
- -- Trying 'NMake Makefiles (Visual Studio 15 2017 x64 v141)' generator
- --------------------------------
- ---------------------------
- ----------------------
- -----------------
- ------------
- -------
- --
- Not searching for unused variables given on the command line.
- CMake Error at CMakeLists.txt:2 (PROJECT):
- Generator
-
- NMake Makefiles
-
- does not support platform specification, but platform
-
- x64
-
- was specified.
-
-
- -- Configuring incomplete, errors occurred!
- --
- -------
- ------------
- -----------------
- ----------------------
- ---------------------------
- --------------------------------
- -- Trying 'NMake Makefiles (Visual Studio 15 2017 x64 v141)' generator - failure
- --------------------------------------------------------------------------------
-
- ********************************************************************************
- scikit-build could not get a working generator for your system. Aborting build.
-
- Building windows wheels for Python 3.6 requires Microsoft Visual Studio 2022.
- Get it with "Visual Studio 2017":
-
- https://visualstudio.microsoft.com/vs/
-
- Or with "Visual Studio 2019":
-
- https://visualstudio.microsoft.com/vs/
-
- Or with "Visual Studio 2022":
-
- https://visualstudio.microsoft.com/vs/
-
- ********************************************************************************
-
- ----------------------------------------
- Failed building wheel for opencv-python
- Running setup.py clean for opencv-python
- Failed to build opencv-python
- Installing collected packages: opencv-python
- Running setup.py install for opencv-python ... error
- Complete output from command D:\ProgramData\Anaconda3\envs\pytorch_test\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\ADMINI~1\\AppData\\Local\\Temp\\pip-build-2q8jwyor\\opencv-python\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record C:\Users\ADMINI~1\AppData\Local\Temp\pip-9fjkd7n3-record\install-record.txt --single-version-externally-managed --compile:
- D:\ProgramData\Anaconda3\envs\pytorch_test\lib\site-packages\setuptools\command\install.py:37: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
- setuptools.SetuptoolsDeprecationWarning,
-
-
- --------------------------------------------------------------------------------
- -- Trying 'Ninja (Visual Studio 17 2022 x64 v143)' generator
- --------------------------------
- ---------------------------
- ----------------------
- -----------------
- ------------
- -------
- --
- Not searching for unused variables given on the command line.
- CMake Error at CMakeLists.txt:2 (PROJECT):
- Generator
-
- Ninja
-
- does not support platform specification, but platform
-
- x64
-
- was specified.
-
-
- -- Configuring incomplete, errors occurred!
- --
- -------
- ------------
- -----------------
- ----------------------
- ---------------------------
- --------------------------------
- -- Trying 'Ninja (Visual Studio 17 2022 x64 v143)' generator - failure
- --------------------------------------------------------------------------------
-
-
-
- --------------------------------------------------------------------------------
- -- Trying 'Visual Studio 17 2022 x64 v143' generator
- --------------------------------
- ---------------------------
- ----------------------
- -----------------
- ------------
- -------
- --
- Not searching for unused variables given on the command line.
- CMake Error at CMakeLists.txt:2 (PROJECT):
- Generator
-
- Visual Studio 17 2022
-
- could not find any instance of Visual Studio.
-
-
-
- -- Configuring incomplete, errors occurred!
- --
- -------
- ------------
- -----------------
- ----------------------
- ---------------------------
- --------------------------------
- -- Trying 'Visual Studio 17 2022 x64 v143' generator - failure
- --------------------------------------------------------------------------------
-
-
-
- --------------------------------------------------------------------------------
- -- Trying 'Ninja (Visual Studio 16 2019 x64 v142)' generator
- --------------------------------
- ---------------------------
- ----------------------
- -----------------
- ------------
- -------
- --
- Not searching for unused variables given on the command line.
- CMake Error at CMakeLists.txt:2 (PROJECT):
- Generator
-
- Ninja
-
- does not support platform specification, but platform
-
- x64
-
- was specified.
-
-
- -- Configuring incomplete, errors occurred!
- --
- -------
- ------------
- -----------------
- ----------------------
- ---------------------------
- --------------------------------
- -- Trying 'Ninja (Visual Studio 16 2019 x64 v142)' generator - failure
- --------------------------------------------------------------------------------
-
-
-
- --------------------------------------------------------------------------------
- -- Trying 'Visual Studio 16 2019 x64 v142' generator
- --------------------------------
- ---------------------------
- ----------------------
- -----------------
- ------------
- -------
- --
- Not searching for unused variables given on the command line.
- CMake Error at CMakeLists.txt:2 (PROJECT):
- Generator
-
- Visual Studio 16 2019
-
- could not find any instance of Visual Studio.
-
-
-
- -- Configuring incomplete, errors occurred!
- --
- -------
- ------------
- -----------------
- ----------------------
- ---------------------------
- --------------------------------
- -- Trying 'Visual Studio 16 2019 x64 v142' generator - failure
- --------------------------------------------------------------------------------
-
-
-
- --------------------------------------------------------------------------------
- -- Trying 'Ninja (Visual Studio 15 2017 x64 v141)' generator
- --------------------------------
- ---------------------------
- ----------------------
- -----------------
- ------------
- -------
- --
- Not searching for unused variables given on the command line.
- CMake Error at CMakeLists.txt:2 (PROJECT):
- Generator
-
- Ninja
-
- does not support platform specification, but platform
-
- x64
-
- was specified.
-
-
- -- Configuring incomplete, errors occurred!
- --
- -------
- ------------
- -----------------
- ----------------------
- ---------------------------
- --------------------------------
- -- Trying 'Ninja (Visual Studio 15 2017 x64 v141)' generator - failure
- --------------------------------------------------------------------------------
-
-
-
- --------------------------------------------------------------------------------
- -- Trying 'Visual Studio 15 2017 x64 v141' generator
- --------------------------------
- ---------------------------
- ----------------------
- -----------------
- ------------
- -------
- --
- Not searching for unused variables given on the command line.
- CMake Error at CMakeLists.txt:2 (PROJECT):
- Generator
-
- Visual Studio 15 2017
-
- could not find any instance of Visual Studio.
-
-
-
- -- Configuring incomplete, errors occurred!
- --
- -------
- ------------
- -----------------
- ----------------------
- ---------------------------
- --------------------------------
- -- Trying 'Visual Studio 15 2017 x64 v141' generator - failure
- --------------------------------------------------------------------------------
-
-
-
- --------------------------------------------------------------------------------
- -- Trying 'NMake Makefiles (Visual Studio 17 2022 x64 v143)' generator
- --------------------------------
- ---------------------------
- ----------------------
- -----------------
- ------------
- -------
- --
- Not searching for unused variables given on the command line.
- CMake Error at CMakeLists.txt:2 (PROJECT):
- Generator
-
- NMake Makefiles
-
- does not support platform specification, but platform
-
- x64
-
- was specified.
-
-
- -- Configuring incomplete, errors occurred!
- --
- -------
- ------------
- -----------------
- ----------------------
- ---------------------------
- --------------------------------
- -- Trying 'NMake Makefiles (Visual Studio 17 2022 x64 v143)' generator - failure
- --------------------------------------------------------------------------------
-
-
-
- --------------------------------------------------------------------------------
- -- Trying 'NMake Makefiles (Visual Studio 16 2019 x64 v142)' generator
- --------------------------------
- ---------------------------
- ----------------------
- -----------------
- ------------
- -------
- --
- Not searching for unused variables given on the command line.
- CMake Error at CMakeLists.txt:2 (PROJECT):
- Generator
-
- NMake Makefiles
-
- does not support platform specification, but platform
-
- x64
-
- was specified.
-
-
- -- Configuring incomplete, errors occurred!
- --
- -------
- ------------
- -----------------
- ----------------------
- ---------------------------
- --------------------------------
- -- Trying 'NMake Makefiles (Visual Studio 16 2019 x64 v142)' generator - failure
- --------------------------------------------------------------------------------
-
-
-
- --------------------------------------------------------------------------------
- -- Trying 'NMake Makefiles (Visual Studio 15 2017 x64 v141)' generator
- --------------------------------
- ---------------------------
- ----------------------
- -----------------
- ------------
- -------
- --
- Not searching for unused variables given on the command line.
- CMake Error at CMakeLists.txt:2 (PROJECT):
- Generator
-
- NMake Makefiles
-
- does not support platform specification, but platform
-
- x64
-
- was specified.
-
-
- -- Configuring incomplete, errors occurred!
- --
- -------
- ------------
- -----------------
- ----------------------
- ---------------------------
- --------------------------------
- -- Trying 'NMake Makefiles (Visual Studio 15 2017 x64 v141)' generator - failure
- --------------------------------------------------------------------------------
-
- ********************************************************************************
- scikit-build could not get a working generator for your system. Aborting build.
-
- Building windows wheels for Python 3.6 requires Microsoft Visual Studio 2022.
- Get it with "Visual Studio 2017":
-
- https://visualstudio.microsoft.com/vs/
-
- Or with "Visual Studio 2019":
-
- https://visualstudio.microsoft.com/vs/
-
- Or with "Visual Studio 2022":
-
- https://visualstudio.microsoft.com/vs/
-
- ********************************************************************************
-
- ----------------------------------------
- Command "D:\ProgramData\Anaconda3\envs\pytorch_test\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\ADMINI~1\\AppData\\Local\\Temp\\pip-build-2q8jwyor\\opencv-python\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record C:\Users\ADMINI~1\AppData\Local\Temp\pip-9fjkd7n3-record\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in C:\Users\ADMINI~1\AppData\Local\Temp\pip-build-2q8jwyor\opencv-python\
又查了一下,发现是版本问题,参考这篇文章解决
解决方法:
pip install opencv-python==3.2.0.7
提示安装成功
- pip install opencv-python==3.2.0.7
- Collecting opencv-python==3.2.0.7
- Downloading https://files.pythonhosted.org/packages/df/14/291f9dd3c73aa35942aece85ee40235a1a3f471856b1c96d37df51142e97/opencv_python-3.2.0.7-cp36-cp36m-win_amd64.whl (22.2MB)
- 100% |████████████████████████████████| 22.2MB 52kB/s
- Requirement already satisfied: numpy>=1.11.3 in d:\programdata\anaconda3\envs\pytorch_test\lib\site-packages (from opencv-python==3.2.0.7)
- Installing collected packages: opencv-python
- Successfully installed opencv-python-3.2.0.7
- You are using pip version 9.0.1, however version 23.1.2 is available.
- You should consider upgrading via the 'python -m pip install --upgrade pip' command.
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。