python - 安装 opencv-contrib-python 后我找不到 cv2.ximgproc
问题描述
我想使用ximgproc的一些功能,所以我卸载了opencv-python并重新安装了opencv-contrib-python
(venv) C:\Users\Administrator\PycharmProjects\eps>pip uninstall opencv-contrib-python opencv-python
Skipping opencv-contrib-python as it is not installed.
Uninstalling opencv-python-4.5.1.48:
Would remove:
c:\users\administrator\pycharmprojects\eps\venv\lib\site-packages\cv2\*
c:\users\administrator\pycharmprojects\eps\venv\lib\site-packages\opencv_python-4.5.1.48.dist-info\*
Proceed (y/n)? y
Successfully uninstalled opencv-python-4.5.1.48
(venv) C:\Users\Administrator\PycharmProjects\eps>pip install opencv-contrib-python
Collecting opencv-contrib-python
Using cached https://files.pythonhosted.org/packages/01/07/4da5e3a2262c033bd10d7f6275b6fb6c77396b2058cedd02e61dbcc4a56d/opencv_contrib_python-4.5.1.48-cp36-cp36m-win_amd64.whl
Requirement already satisfied: numpy>=1.13.3 in c:\users\administrator\pycharmprojects\eps\venv\lib\site-packages (from opencv-contrib-python) (1.18.2)
Installing collected packages: opencv-contrib-python
Successfully installed opencv-contrib-python-4.5.1.48
但是,我仍然无法导入 ximgproc。有什么我忘记了吗?
解决方案
你能检查一下你安装了哪些包pip list
吗?即使你卸载了 opencv-python,你也需要卸载opencv-python-headless, opencv-contrib-python-headless
包。正如@skvark 所说
从不安装这两个包
推荐阅读
- debugging - 如何调试 Firefox 扩展,它似乎无声无息地崩溃
- android - 已编译的 apk 正在尝试到达 metor 服务器反应本机
- php - 以 n 为单位分离和写入数据集的功能不起作用。尝试了 array_slice 和 for-loop
- java - 当用户单击 SearchView 和键盘打开时如何隐藏 FAB?
- docker - 如何在 Google Cloud 上 Ubuntu 机器的 Docker 容器中设置 Atlassian JIRA Core
- json - Flutter:如何“自动序列化为 JSON”IconData 对象?
- c# - 如果状态码不等于 200 则使用 Polly 重试 api 请求 OK
- html - 如何增加模态窗口的宽度
- pandas - 如何在不使用任何输入代码的情况下从文件中跳过行直到特定字符串?
- visual-studio - 如何获得原始的 One Dark Theme 字体?