python - 无法使用 pipenv 和 Python 3.8 安装 opencv-python
问题描述
我刚刚在我的 Mac OS X (10.15.1) 上安装了 Python 3.8,并试图添加opencv-python
到我的 pipenv 项目中。我做了以下事情:
$> pipenv install opencv-python
Installing dependencies from Pipfile.lock (ec16ad)…
An error occurred while installing opencv-python==4.1.1.26 --hash=sha256:01505b131dc35f60e99a5da98b77156e37f872ae0ff5596e5e68d526bb572d3c --hash=sha256:0478a1037505ddde312806c960a5e8958d2cf7a2885e8f2f5dde74c4028e0b04 --hash=sha256:17810b89f9ef8e8537e75332acf533e619e26ccadbf1b73f24bf338f2d327ddd --hash=sha256:19ad2ea9fb32946761b47b9d6eed51876a8329da127f27788263fecd66651ba0 --hash=sha256:1a250edb739baf3e7c25d99a2ee252aac4f59a97e0bee39237eaa490fd0281d3 --hash=sha256:3505468970448f66cd776cb9e179570c87988f94b5cf9bcbc4c2d88bd88bbdf1 --hash=sha256:4e04a91da157885359f487534433340b2d709927559c80acf62c28167e59be02 --hash=sha256:5a49cffcdec5e37217672579c3343565926d999642844efa9c6a031ed5f32318 --hash=sha256:604b2ce3d4a86480ced0813da7fba269b4605ad9fea26cd2144d8077928d4b49 --hash=sha256:61cbb8fa9565a0480c46028599431ad8f19181a7fac8070a700515fd54cd7377 --hash=sha256:62d7c6e511c9454f099616315c695d02a584048e1affe034b39160db7a2ae34d --hash=sha256:6555272dd9efd412d17cdc1a4f4c2da5753c099d95d9ff01aca54bb9782fb5cf --hash=sha256:67d994c6b2b14cb9239e85dc7dfa6c08ef7cf6eb4def80c0af6141dfacc8cbb9 --hash=sha256:68c9cbe538666c4667523821cc56caee49389bea06bae4c0fc2cd68bd264226a --hash=sha256:822ad8f628a9498f569c57d30865f5ef9ee17824cee0a1d456211f742028c135 --hash=sha256:82d972429eb4fee22c1dc4204af2a2e981f010e5e4f66daea2a6c68381b79184 --hash=sha256:9128924f5b58269ee221b8cf2d736f31bd3bb0391b92ee8504caadd68c8176a2 --hash=sha256:9172cf8270572c494d8b2ae12ef87c0f6eed9d132927e614099f76843b0c91d7 --hash=sha256:952bce4d30a8287b17721ddaad7f115dab268efee8576249ddfede80ec2ce404 --hash=sha256:a8147718e70b1f170a3d26518e992160137365a4db0ed82a9efd3040f9f660d4 --hash=sha256:bfdb636a3796ff223460ea0fcfda906b3b54f4bef22ae433a5b67e66fab00b25 --hash=sha256:c9c3f27867153634e1083390920067008ebaaab78aeb09c4e0274e69746cb2c8 --hash=sha256:d69be21973d450a4662ae6bd1b3df6b1af030e448d7276380b0d1adf7c8c2ae6 --hash=sha256:db1479636812a6579a3753b72a6fefaa73190f32bf7b19e483f8bc750cebe1a5 --hash=sha256:db8313d755962a7dd61e5c22a651e0743208adfdb255c6ec8904ce9cb02940c6 --hash=sha256:e4625a6b032e7797958aeb630d6e3e91e3896d285020aae612e6d7b342d6dfea --hash=sha256:e8397a26966a1290836a52c34b362aabc65a422b9ffabcbbdec1862f023ccab8! Will try again.
▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉ 2/2 — 00:00:00
Installing initially failed dependencies…
[pipenv.exceptions.InstallError]: File "/Users/stevenbarnett/Library/Python/3.8/lib/python/site-packages/pipenv/core.py", line 1863, in do_install
[pipenv.exceptions.InstallError]: do_init(
[pipenv.exceptions.InstallError]: File "/Users/stevenbarnett/Library/Python/3.8/lib/python/site-packages/pipenv/core.py", line 1246, in do_init
[pipenv.exceptions.InstallError]: do_install_dependencies(
[pipenv.exceptions.InstallError]: File "/Users/stevenbarnett/Library/Python/3.8/lib/python/site-packages/pipenv/core.py", line 858, in do_install_dependencies
[pipenv.exceptions.InstallError]: batch_install(
[pipenv.exceptions.InstallError]: File "/Users/stevenbarnett/Library/Python/3.8/lib/python/site-packages/pipenv/core.py", line 763, in batch_install
[pipenv.exceptions.InstallError]: _cleanup_procs(procs, not blocking, failed_deps_queue, retry=retry)
[pipenv.exceptions.InstallError]: File "/Users/stevenbarnett/Library/Python/3.8/lib/python/site-packages/pipenv/core.py", line 681, in _cleanup_procs
[pipenv.exceptions.InstallError]: raise exceptions.InstallError(c.dep.name, extra=err_lines)
[pipenv.exceptions.InstallError]: []
[pipenv.exceptions.InstallError]: ['ERROR: Could not find a version that satisfies the requirement opencv-python==4.1.1.26 (from -r /var/folders/17/82l5td8d01nbgslcj1lbfh8r0000gn/T/pipenv-glzkfmcm-requirements/pipenv-a34e3whg-requirement.txt (line 1)) (from versions: none)', 'ERROR: No matching distribution found for opencv-python==4.1.1.26 (from -r /var/folders/17/82l5td8d01nbgslcj1lbfh8r0000gn/T/pipenv-glzkfmcm-requirements/pipenv-a34e3whg-requirement.txt (line 1))']
ERROR: ERROR: Package installation failed...
☤ ▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉ 0/1 — 00:00:00
$>
我究竟做错了什么?我认为 pipenv 应该防止所有这些依赖错误......
解决方案
正如@eyllanesc 提到的,请尝试为python 的较低版本安装opencv-python,例如python 3.7
原因仍然是 python 3.8 包尚未可用于 opencv-python,如下面的 url 所示。
推荐阅读
- c - C中函数调用约定的历史
- java - 没有为 MultipartFile 配置 Spring Boot 2.0.2 MultipartConfigElement
- javascript - 在 HTML 中将变量从 JavaScript 转换为 PHP?
- django - Django:无法在模板中显示来自抽象模型的数据
- java - 禁用时如何使 JCheckBox L&F 保持启用状态(true)?
- shell - 如何在没有 eval 的情况下将包括引号在内的参数字符串传递给命令
- c++ - VSCode C++ 调试捕获控制台输出
- c++ - OpenGL 如何区分 VAO 中的绑定点和使用 glBindBufferBase 定义的绑定点?
- objective-c - 如何调用没有来自 Swift 的参数的 Objective-C `initFoo` 方法?
- r - 使用 ggplot2 和 viridis,根据其他变量填充直方图