Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

windows下 pip install opencv-python 报错 #7

Open
lix19937 opened this issue Feb 21, 2024 · 3 comments
Open

windows下 pip install opencv-python 报错 #7

lix19937 opened this issue Feb 21, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@lix19937
Copy link
Owner

lix19937 commented Feb 21, 2024

Python 3.6.8 环境下

 pip install opencv-python==4.9.0.80 -i http://mirrors.aliyun.com/pypi/simple/  --trusted-host mirrors.aliyun.com
    opencv_imgproc_SSE4_1.vcxproj -> C:\Users\lix\AppData\Local\Temp\pip-install-6pordhje\opencv-python_fe0dad2395584b32a0aaaef0f66c20bb\_skbuild\win-amd64-3.6\cmake
-build\modules\imgproc\opencv_imgproc_SSE4_1.dir\Release\opencv_imgproc_SSE4_1.lib
  e:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\VC\VCTargets\Microsoft.CppBuild.targets(399,5): warning MSB8029: 中间目录或输出目录无法驻
留在临时目录下,因为这可能会导致增量生成出现问题。 [C:\Users\lix\AppData\Local\Temp\pip-install-6pordhje\opencv-python_fe0dad2395584b32a0aaaef0f66c20bb\_skbuild\win-
amd64-3.6\cmake-build\modules\python_bindings_generator\gen_opencv_python_source.vcxproj]
  e:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\VC\VCTargets\Microsoft.CppBuild.targets(321,5): error MSB3491: 未能向文件“x64\Release\ge
n_opencv_python_source\gen_open.F3A9E34F.tlog\gen_opencv_python_source.lastbuildstate”写入命令行。指定的路径或文件名太长,或者两者都太长。完全限定文件名必须少于 260
 个字符,并且目录名必须少于 248 个字符。 [C:\Users\lix\AppData\Local\Temp\pip-install-6pordhje\opencv-python_fe0dad2395584b32a0aaaef0f66c20bb\_skbuild\win-amd64-3.6\
cmake-build\modules\python_bindings_generator\gen_opencv_python_source.vcxproj]
  e:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\VC\VCTargets\Microsoft.CppBuild.targets(399,5): warning MSB8029: 中间目录或输出目录无法驻
留在临时目录下,因为这可能会导致增量生成出现问题。 [C:\Users\lix\AppData\Local\Temp\pip-install-6pordhje\opencv-python_fe0dad2395584b32a0aaaef0f66c20bb\_skbuild\win-
amd64-3.6\cmake-build\modules\.firstpass\videoio\opencv_videoio_plugins.vcxproj]
    Building Custom Rule C:/Users/lix/AppData/Local/Temp/pip-install-6pordhje/opencv-python_fe0dad2395584b32a0aaaef0f66c20bb/opencv/modules/videoio/CMakeLists.txt
  Traceback (most recent call last):

@lix19937
Copy link
Owner Author

lix19937 commented Feb 21, 2024

发现是python版本比较低,直接安装的话,高版本的opencv和低版本的python难以匹配。

pip install opencv-python==4.9.0.80 -i http://mirrors.aliyun.com/pypi/simple/  --trusted-host mirrors.aliyun.com

改为

pip install opencv-python==4.2.0.34 -i http://mirrors.aliyun.com/pypi/simple/  --trusted-host mirrors.aliyun.com

OK

ref
https://blog.csdn.net/WYKB_Mr_Q/article/details/131677242
https://stackoverflow.com/questions/64373381/error-could-not-build-wheels-for-opencv-python-which-use-pep-517-and-cannot-be

@lix19937 lix19937 added the bug Something isn't working label Feb 21, 2024
@lix19937
Copy link
Owner Author

also see #2

@lix19937
Copy link
Owner Author

pip install opencv-python==4.4.0.46 -i http://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant