当前位置:   article > 正文

opencv问题记录_trying 'ninja (visual studio 17 2022 x64 v143)' ge

trying 'ninja (visual studio 17 2022 x64 v143)' generator

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'

此时无法正常打开视频

错误原因:

合成视频时,编码类型错误

解决方法:

  • 1.将fourcc = cv2.VideoWriter_fourcc(*“MJPG”)的"MJPG"改成"mp4v"
  • 2.将vw = cv2.VideoWriter(path, fourcc, fps, im.size)的fourcc直接改成 0x00000021

 实测第一种可以用,参考文章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

结果到这里仍然报错

  1. pip install opencv-python
  2. Collecting opencv-python
  3. Downloading https://files.pythonhosted.org/packages/40/93/655af887bafece2a655998f53b9bd21ad94b0627d81d44aef35c79f40de6/opencv-python-4.7.0.72.tar.gz (91.1MB)
  4. 100% |████████████████████████████████| 91.1MB 12kB/s
  5. Requirement already satisfied: numpy>=1.13.3 in d:\programdata\anaconda3\envs\pytorch_test\lib\site-packages (from opencv-python)
  6. Building wheels for collected packages: opencv-python
  7. Running setup.py bdist_wheel for opencv-python ... error
  8. 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:
  9. --------------------------------------------------------------------------------
  10. -- Trying 'Ninja (Visual Studio 17 2022 x64 v143)' generator
  11. --------------------------------
  12. ---------------------------
  13. ----------------------
  14. -----------------
  15. ------------
  16. -------
  17. --
  18. Not searching for unused variables given on the command line.
  19. CMake Error at CMakeLists.txt:2 (PROJECT):
  20. Generator
  21. Ninja
  22. does not support platform specification, but platform
  23. x64
  24. was specified.
  25. -- Configuring incomplete, errors occurred!
  26. --
  27. -------
  28. ------------
  29. -----------------
  30. ----------------------
  31. ---------------------------
  32. --------------------------------
  33. -- Trying 'Ninja (Visual Studio 17 2022 x64 v143)' generator - failure
  34. --------------------------------------------------------------------------------
  35. --------------------------------------------------------------------------------
  36. -- Trying 'Visual Studio 17 2022 x64 v143' generator
  37. --------------------------------
  38. ---------------------------
  39. ----------------------
  40. -----------------
  41. ------------
  42. -------
  43. --
  44. Not searching for unused variables given on the command line.
  45. CMake Error at CMakeLists.txt:2 (PROJECT):
  46. Generator
  47. Visual Studio 17 2022
  48. could not find any instance of Visual Studio.
  49. -- Configuring incomplete, errors occurred!
  50. --
  51. -------
  52. ------------
  53. -----------------
  54. ----------------------
  55. ---------------------------
  56. --------------------------------
  57. -- Trying 'Visual Studio 17 2022 x64 v143' generator - failure
  58. --------------------------------------------------------------------------------
  59. --------------------------------------------------------------------------------
  60. -- Trying 'Ninja (Visual Studio 16 2019 x64 v142)' generator
  61. --------------------------------
  62. ---------------------------
  63. ----------------------
  64. -----------------
  65. ------------
  66. -------
  67. --
  68. Not searching for unused variables given on the command line.
  69. CMake Error at CMakeLists.txt:2 (PROJECT):
  70. Generator
  71. Ninja
  72. does not support platform specification, but platform
  73. x64
  74. was specified.
  75. -- Configuring incomplete, errors occurred!
  76. --
  77. -------
  78. ------------
  79. -----------------
  80. ----------------------
  81. ---------------------------
  82. --------------------------------
  83. -- Trying 'Ninja (Visual Studio 16 2019 x64 v142)' generator - failure
  84. --------------------------------------------------------------------------------
  85. --------------------------------------------------------------------------------
  86. -- Trying 'Visual Studio 16 2019 x64 v142' generator
  87. --------------------------------
  88. ---------------------------
  89. ----------------------
  90. -----------------
  91. ------------
  92. -------
  93. --
  94. Not searching for unused variables given on the command line.
  95. CMake Error at CMakeLists.txt:2 (PROJECT):
  96. Generator
  97. Visual Studio 16 2019
  98. could not find any instance of Visual Studio.
  99. -- Configuring incomplete, errors occurred!
  100. --
  101. -------
  102. ------------
  103. -----------------
  104. ----------------------
  105. ---------------------------
  106. --------------------------------
  107. -- Trying 'Visual Studio 16 2019 x64 v142' generator - failure
  108. --------------------------------------------------------------------------------
  109. --------------------------------------------------------------------------------
  110. -- Trying 'Ninja (Visual Studio 15 2017 x64 v141)' generator
  111. --------------------------------
  112. ---------------------------
  113. ----------------------
  114. -----------------
  115. ------------
  116. -------
  117. --
  118. Not searching for unused variables given on the command line.
  119. CMake Error at CMakeLists.txt:2 (PROJECT):
  120. Generator
  121. Ninja
  122. does not support platform specification, but platform
  123. x64
  124. was specified.
  125. -- Configuring incomplete, errors occurred!
  126. --
  127. -------
  128. ------------
  129. -----------------
  130. ----------------------
  131. ---------------------------
  132. --------------------------------
  133. -- Trying 'Ninja (Visual Studio 15 2017 x64 v141)' generator - failure
  134. --------------------------------------------------------------------------------
  135. --------------------------------------------------------------------------------
  136. -- Trying 'Visual Studio 15 2017 x64 v141' generator
  137. --------------------------------
  138. ---------------------------
  139. ----------------------
  140. -----------------
  141. ------------
  142. -------
  143. --
  144. Not searching for unused variables given on the command line.
  145. CMake Error at CMakeLists.txt:2 (PROJECT):
  146. Generator
  147. Visual Studio 15 2017
  148. could not find any instance of Visual Studio.
  149. -- Configuring incomplete, errors occurred!
  150. --
  151. -------
  152. ------------
  153. -----------------
  154. ----------------------
  155. ---------------------------
  156. --------------------------------
  157. -- Trying 'Visual Studio 15 2017 x64 v141' generator - failure
  158. --------------------------------------------------------------------------------
  159. --------------------------------------------------------------------------------
  160. -- Trying 'NMake Makefiles (Visual Studio 17 2022 x64 v143)' generator
  161. --------------------------------
  162. ---------------------------
  163. ----------------------
  164. -----------------
  165. ------------
  166. -------
  167. --
  168. Not searching for unused variables given on the command line.
  169. CMake Error at CMakeLists.txt:2 (PROJECT):
  170. Generator
  171. NMake Makefiles
  172. does not support platform specification, but platform
  173. x64
  174. was specified.
  175. -- Configuring incomplete, errors occurred!
  176. --
  177. -------
  178. ------------
  179. -----------------
  180. ----------------------
  181. ---------------------------
  182. --------------------------------
  183. -- Trying 'NMake Makefiles (Visual Studio 17 2022 x64 v143)' generator - failure
  184. --------------------------------------------------------------------------------
  185. --------------------------------------------------------------------------------
  186. -- Trying 'NMake Makefiles (Visual Studio 16 2019 x64 v142)' generator
  187. --------------------------------
  188. ---------------------------
  189. ----------------------
  190. -----------------
  191. ------------
  192. -------
  193. --
  194. Not searching for unused variables given on the command line.
  195. CMake Error at CMakeLists.txt:2 (PROJECT):
  196. Generator
  197. NMake Makefiles
  198. does not support platform specification, but platform
  199. x64
  200. was specified.
  201. -- Configuring incomplete, errors occurred!
  202. --
  203. -------
  204. ------------
  205. -----------------
  206. ----------------------
  207. ---------------------------
  208. --------------------------------
  209. -- Trying 'NMake Makefiles (Visual Studio 16 2019 x64 v142)' generator - failure
  210. --------------------------------------------------------------------------------
  211. --------------------------------------------------------------------------------
  212. -- Trying 'NMake Makefiles (Visual Studio 15 2017 x64 v141)' generator
  213. --------------------------------
  214. ---------------------------
  215. ----------------------
  216. -----------------
  217. ------------
  218. -------
  219. --
  220. Not searching for unused variables given on the command line.
  221. CMake Error at CMakeLists.txt:2 (PROJECT):
  222. Generator
  223. NMake Makefiles
  224. does not support platform specification, but platform
  225. x64
  226. was specified.
  227. -- Configuring incomplete, errors occurred!
  228. --
  229. -------
  230. ------------
  231. -----------------
  232. ----------------------
  233. ---------------------------
  234. --------------------------------
  235. -- Trying 'NMake Makefiles (Visual Studio 15 2017 x64 v141)' generator - failure
  236. --------------------------------------------------------------------------------
  237. ********************************************************************************
  238. scikit-build could not get a working generator for your system. Aborting build.
  239. Building windows wheels for Python 3.6 requires Microsoft Visual Studio 2022.
  240. Get it with "Visual Studio 2017":
  241. https://visualstudio.microsoft.com/vs/
  242. Or with "Visual Studio 2019":
  243. https://visualstudio.microsoft.com/vs/
  244. Or with "Visual Studio 2022":
  245. https://visualstudio.microsoft.com/vs/
  246. ********************************************************************************
  247. ----------------------------------------
  248. Failed building wheel for opencv-python
  249. Running setup.py clean for opencv-python
  250. Failed to build opencv-python
  251. Installing collected packages: opencv-python
  252. Running setup.py install for opencv-python ... error
  253. 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:
  254. 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.
  255. setuptools.SetuptoolsDeprecationWarning,
  256. --------------------------------------------------------------------------------
  257. -- Trying 'Ninja (Visual Studio 17 2022 x64 v143)' generator
  258. --------------------------------
  259. ---------------------------
  260. ----------------------
  261. -----------------
  262. ------------
  263. -------
  264. --
  265. Not searching for unused variables given on the command line.
  266. CMake Error at CMakeLists.txt:2 (PROJECT):
  267. Generator
  268. Ninja
  269. does not support platform specification, but platform
  270. x64
  271. was specified.
  272. -- Configuring incomplete, errors occurred!
  273. --
  274. -------
  275. ------------
  276. -----------------
  277. ----------------------
  278. ---------------------------
  279. --------------------------------
  280. -- Trying 'Ninja (Visual Studio 17 2022 x64 v143)' generator - failure
  281. --------------------------------------------------------------------------------
  282. --------------------------------------------------------------------------------
  283. -- Trying 'Visual Studio 17 2022 x64 v143' generator
  284. --------------------------------
  285. ---------------------------
  286. ----------------------
  287. -----------------
  288. ------------
  289. -------
  290. --
  291. Not searching for unused variables given on the command line.
  292. CMake Error at CMakeLists.txt:2 (PROJECT):
  293. Generator
  294. Visual Studio 17 2022
  295. could not find any instance of Visual Studio.
  296. -- Configuring incomplete, errors occurred!
  297. --
  298. -------
  299. ------------
  300. -----------------
  301. ----------------------
  302. ---------------------------
  303. --------------------------------
  304. -- Trying 'Visual Studio 17 2022 x64 v143' generator - failure
  305. --------------------------------------------------------------------------------
  306. --------------------------------------------------------------------------------
  307. -- Trying 'Ninja (Visual Studio 16 2019 x64 v142)' generator
  308. --------------------------------
  309. ---------------------------
  310. ----------------------
  311. -----------------
  312. ------------
  313. -------
  314. --
  315. Not searching for unused variables given on the command line.
  316. CMake Error at CMakeLists.txt:2 (PROJECT):
  317. Generator
  318. Ninja
  319. does not support platform specification, but platform
  320. x64
  321. was specified.
  322. -- Configuring incomplete, errors occurred!
  323. --
  324. -------
  325. ------------
  326. -----------------
  327. ----------------------
  328. ---------------------------
  329. --------------------------------
  330. -- Trying 'Ninja (Visual Studio 16 2019 x64 v142)' generator - failure
  331. --------------------------------------------------------------------------------
  332. --------------------------------------------------------------------------------
  333. -- Trying 'Visual Studio 16 2019 x64 v142' generator
  334. --------------------------------
  335. ---------------------------
  336. ----------------------
  337. -----------------
  338. ------------
  339. -------
  340. --
  341. Not searching for unused variables given on the command line.
  342. CMake Error at CMakeLists.txt:2 (PROJECT):
  343. Generator
  344. Visual Studio 16 2019
  345. could not find any instance of Visual Studio.
  346. -- Configuring incomplete, errors occurred!
  347. --
  348. -------
  349. ------------
  350. -----------------
  351. ----------------------
  352. ---------------------------
  353. --------------------------------
  354. -- Trying 'Visual Studio 16 2019 x64 v142' generator - failure
  355. --------------------------------------------------------------------------------
  356. --------------------------------------------------------------------------------
  357. -- Trying 'Ninja (Visual Studio 15 2017 x64 v141)' generator
  358. --------------------------------
  359. ---------------------------
  360. ----------------------
  361. -----------------
  362. ------------
  363. -------
  364. --
  365. Not searching for unused variables given on the command line.
  366. CMake Error at CMakeLists.txt:2 (PROJECT):
  367. Generator
  368. Ninja
  369. does not support platform specification, but platform
  370. x64
  371. was specified.
  372. -- Configuring incomplete, errors occurred!
  373. --
  374. -------
  375. ------------
  376. -----------------
  377. ----------------------
  378. ---------------------------
  379. --------------------------------
  380. -- Trying 'Ninja (Visual Studio 15 2017 x64 v141)' generator - failure
  381. --------------------------------------------------------------------------------
  382. --------------------------------------------------------------------------------
  383. -- Trying 'Visual Studio 15 2017 x64 v141' generator
  384. --------------------------------
  385. ---------------------------
  386. ----------------------
  387. -----------------
  388. ------------
  389. -------
  390. --
  391. Not searching for unused variables given on the command line.
  392. CMake Error at CMakeLists.txt:2 (PROJECT):
  393. Generator
  394. Visual Studio 15 2017
  395. could not find any instance of Visual Studio.
  396. -- Configuring incomplete, errors occurred!
  397. --
  398. -------
  399. ------------
  400. -----------------
  401. ----------------------
  402. ---------------------------
  403. --------------------------------
  404. -- Trying 'Visual Studio 15 2017 x64 v141' generator - failure
  405. --------------------------------------------------------------------------------
  406. --------------------------------------------------------------------------------
  407. -- Trying 'NMake Makefiles (Visual Studio 17 2022 x64 v143)' generator
  408. --------------------------------
  409. ---------------------------
  410. ----------------------
  411. -----------------
  412. ------------
  413. -------
  414. --
  415. Not searching for unused variables given on the command line.
  416. CMake Error at CMakeLists.txt:2 (PROJECT):
  417. Generator
  418. NMake Makefiles
  419. does not support platform specification, but platform
  420. x64
  421. was specified.
  422. -- Configuring incomplete, errors occurred!
  423. --
  424. -------
  425. ------------
  426. -----------------
  427. ----------------------
  428. ---------------------------
  429. --------------------------------
  430. -- Trying 'NMake Makefiles (Visual Studio 17 2022 x64 v143)' generator - failure
  431. --------------------------------------------------------------------------------
  432. --------------------------------------------------------------------------------
  433. -- Trying 'NMake Makefiles (Visual Studio 16 2019 x64 v142)' generator
  434. --------------------------------
  435. ---------------------------
  436. ----------------------
  437. -----------------
  438. ------------
  439. -------
  440. --
  441. Not searching for unused variables given on the command line.
  442. CMake Error at CMakeLists.txt:2 (PROJECT):
  443. Generator
  444. NMake Makefiles
  445. does not support platform specification, but platform
  446. x64
  447. was specified.
  448. -- Configuring incomplete, errors occurred!
  449. --
  450. -------
  451. ------------
  452. -----------------
  453. ----------------------
  454. ---------------------------
  455. --------------------------------
  456. -- Trying 'NMake Makefiles (Visual Studio 16 2019 x64 v142)' generator - failure
  457. --------------------------------------------------------------------------------
  458. --------------------------------------------------------------------------------
  459. -- Trying 'NMake Makefiles (Visual Studio 15 2017 x64 v141)' generator
  460. --------------------------------
  461. ---------------------------
  462. ----------------------
  463. -----------------
  464. ------------
  465. -------
  466. --
  467. Not searching for unused variables given on the command line.
  468. CMake Error at CMakeLists.txt:2 (PROJECT):
  469. Generator
  470. NMake Makefiles
  471. does not support platform specification, but platform
  472. x64
  473. was specified.
  474. -- Configuring incomplete, errors occurred!
  475. --
  476. -------
  477. ------------
  478. -----------------
  479. ----------------------
  480. ---------------------------
  481. --------------------------------
  482. -- Trying 'NMake Makefiles (Visual Studio 15 2017 x64 v141)' generator - failure
  483. --------------------------------------------------------------------------------
  484. ********************************************************************************
  485. scikit-build could not get a working generator for your system. Aborting build.
  486. Building windows wheels for Python 3.6 requires Microsoft Visual Studio 2022.
  487. Get it with "Visual Studio 2017":
  488. https://visualstudio.microsoft.com/vs/
  489. Or with "Visual Studio 2019":
  490. https://visualstudio.microsoft.com/vs/
  491. Or with "Visual Studio 2022":
  492. https://visualstudio.microsoft.com/vs/
  493. ********************************************************************************
  494. ----------------------------------------
  495. 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\

 又查了一下,发现是版本问题,参考这篇文章解决

安装cv报错_小鲨鱼停止了思考的博客-CSDN博客

解决方法:

pip install opencv-python==3.2.0.7

提示安装成功 

  1. pip install opencv-python==3.2.0.7
  2. Collecting opencv-python==3.2.0.7
  3. Downloading https://files.pythonhosted.org/packages/df/14/291f9dd3c73aa35942aece85ee40235a1a3f471856b1c96d37df51142e97/opencv_python-3.2.0.7-cp36-cp36m-win_amd64.whl (22.2MB)
  4. 100% |████████████████████████████████| 22.2MB 52kB/s
  5. Requirement already satisfied: numpy>=1.11.3 in d:\programdata\anaconda3\envs\pytorch_test\lib\site-packages (from opencv-python==3.2.0.7)
  6. Installing collected packages: opencv-python
  7. Successfully installed opencv-python-3.2.0.7
  8. You are using pip version 9.0.1, however version 23.1.2 is available.
  9. You should consider upgrading via the 'python -m pip install --upgrade pip' command.

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/知新_RL/article/detail/484773
推荐阅读
相关标签
  

闽ICP备14008679号