当前位置:首页 » 编程语言 » opencv2python3

opencv2python3

发布时间: 2022-06-10 09:39:34

python 3 怎么添加opencv

先进入如下连接下载python和系统版本对应的opencv包:
http://www.lfd.uci.e/~gohlke/pythonlibs/#opencv
比如我的版本是64位的python 3.41,那么我就下载:
opencv_python-3.1.0-cp34-cp34m-win_amd64.whl
2
下载后修改文件名(这就是安装中的坑了,不改是安不了的):
把原来文件名opencv_python-3.1.0-cp34-cp34m-win_amd64.whl中间的cp34m变为none,这样文件名改为:opencv_python-3.1.0-cp34-none-win_amd64.whl
如果不改的话不然会出现:
opencv_python-3.1.0-cp34-cp34m-win_amd64.whl is not a supported wheel on this platform.
3
打开cmd(window键+R,输入cmd就出现),在命令行输入:
pip3 install 路径名\opencv_python-3.1.0-cp34-none-win_amd64.whl
这样就好了。

② tensorflow是python3怎么安装opencv

1.下载whl文件
来到这里
搜索适合你的python版本的whl,比如我是python3.5,就选cp35的包
我选择了
opencv_python‑3.2.0‑cp35‑cp35m‑win_amd64.whl
还有
tensorflow‑0.12.0‑cp35‑cp35m‑win_amd64.whl
对应的我的python-3.5.如果你是3.6请选择cp36的版本
2.安装
下载好后将两个文件复制到你的anaconda目录下,使用pip安装两个文件
D:\Anaconda3>pip install ./opencv_python-3.2.0-cp35-cp35m-win_amd64.whl11
D:\Anaconda3>pip install ./tensorflow-0.12.0-cp35-cp35m-win_amd64.whl11

如果一切顺利,你会看到这个画面

3.成功
安装成功!
在python中已经可以import啦!

③ opencv3.2为什么还不发布官方python3版本

你可以自己下wheel文件装啊,已经有支持py3的包了,去这个网站:
http://www.lfd.uci.e/~gohlke/pythonlibs/
OpenCV, a real time computer vision library.
opencv_python‑2.4.13.2‑cp27‑cp27m‑win32.whl
opencv_python‑2.4.13.2‑cp27‑cp27m‑win_amd64.whl
opencv_python‑3.1.0‑cp27‑cp27m‑win32.whl
opencv_python‑3.1.0‑cp27‑cp27m‑win_amd64.whl
opencv_python‑3.1.0‑cp34‑cp34m‑win32.whl
opencv_python‑3.1.0‑cp34‑cp34m‑win_amd64.whl
opencv_python‑3.2.0+contrib‑cp35‑cp35m‑win32.whl
opencv_python‑3.2.0+contrib‑cp35‑cp35m‑win_amd64.whl
opencv_python‑3.2.0+contrib‑cp36‑cp36m‑win32.whl
opencv_python‑3.2.0+contrib‑cp36‑cp36m‑win_amd64.whl
opencv_python‑3.2.0‑cp35‑cp35m‑win32.whl
opencv_python‑3.2.0‑cp35‑cp35m‑win_amd64.whl
opencv_python‑3.2.0‑cp36‑cp36m‑win32.whl
opencv_python‑3.2.0‑cp36‑cp36m‑win_amd64.whl

④ opencv的python版本的(4.1.0.25)是不是包括了opencv2和opencv3啊

就opencv本身而言,opencv是用c++写的,但是提供python的接口,c++执行效率更高,python开发效率更高(前提是python和c++都同样熟悉)。

⑤ ubuntu中opencv2可以加载python3么

可以

Installing OpenCV in Ubuntu for Python 3

byWK· Published March 2, 2016 · Updated March 3, 2017

Installing OpenCV in linux for Python 3 is not that straight forward, so in this tutorial, we’ll go through the steps on how do we do it. We’ll be using a 64 bit Ubuntu 16.04 system, and Python 3.5 in this tutorial. (It should also work for Ubuntu 12.04++ onwards and Python 3.x)

(While ing the code over,do notinclude the >>> in the terminal: It’s just used to represent the python input.)

Contents[hide]

  • 1Packages Required

  • 2Copying the Python dev file

  • 3Downloading the OpenCV Source Code

  • 4Building

  • 5Installing

  • 6Checking

  • 7Python Libraries

  • 8Troubleshooting

  • 9References

  • Packages Required

    Before compiling OpenCV, we have to download some packages for compilation.

    Update the repository before installing the necessary packages.

    1

  • sudoapt-getupdate

  • Once the update is done, we’ll proceed on to downloading the required packages to compile OpenCV.

  • GCC

  • CMake

  • Git

  • GTK+2.x or higher, including headers (libgtk2.0-dev)

  • pkg-config

  • ffmpeg or libav development packages: libavcodec-dev, libavformat-dev, libswscale-dev

  • 1

  • sudoapt-getinstallbuild-essentialcmakegitlibgtk2.0-devpkg-configlibavcodec-devlibavformat-devlibswscale-dev

  • Next, we will install the developer packages for python3. If you are using a different version of python, change it to python3.x-dev. (E.g. If you are using Python 3.3, use this instead: python3.3-dev)

    1

  • sudoapt-getinstallpython3.5-dev

  • Copying the Python dev file

    (If you using Python 3.2 or below, you can skip to the next step.)

    As the pycofig.h header file is not in the typical place, we would have to the file to the expected location. Run the following code below:

    1

  • python3.5-config--includes

  • The output would look something similar below:

    1

  • -I/usr/include/python3.5m-I/usr/include/x86_64-linux-gnu/python3.5m

  • The first part of the output is the expected location & the second part shows the current location of the config file. To solve this problem, we’ll the file from the current location to the expected location.

    1

  • sudocp/usr/include/x86_64-linux-gnu/python3.5m/pyconfig.h/usr/include/python3.5m/

  • Downloading the OpenCV Source Code

    Make a new directoryOpenCV-tmpin your Desktop, then change the directory intoOpenCV-tmp. We will be using cloning the OpenCV source from Github into this folder.

    1

    2

    3

  • mkdirOpenCV-tmp

    cdOpenCV-tmp

    gitclone ez/opencv.git

  • Aopencvdirectory will be created inOpenCV-tmp. Renameopencvtoopencv-3.

    Building

    Before compiling the source, we have to generate the make file, so we will be using cmake.

    Create a new directorybuild,which we will build the makefile in. Change the directory into it.

    After that, run the cmake utility:

    1

  • cmake-DCMAKE_BUILD_TYPE=RELEASE-DCMAKE_INSTALL_PREFIX=/usr/local../opencv-3

  • If the command above does not work, you can try this alternative command: (Thanks tosupermdguyfor pointing this out!)

    1

  • cmake-DCMAKE_BUILD_TYPE=RELEASE-DCMAKE_INSTALL_PREFIX=/usr/local..

  • After the makefile is generated, we will build the installation files:

    1

  • make-j$(nproc--all)

  • This may take some time depending on your computer.

    Side note:We’ll split themaketask via the-jargument, and the$(nproc -all)bash command to use all the processors available. Say if you want to only use 2 of the processors to run themakecommand, the command would look like this:

    1

  • make-j2

  • Installing

    Once the build is complete, we’ll install OpenCV by running the make file:

    1

  • sudomakeinstall

  • Checking

    After OpenCV have finished installing, we have to check to ensure that OpenCV have been properly installed .

    To do this, we’ll enter Python 3 and importcv2,and also check it’s version. If there are no errors, the output should look something like this:

    1

    2

    3

  • >>>importcv2

    >>>cv2.__version__

    '3.1.0-dev'

  • With this, you have successfully installed OpenCV for Python 3!

    Python Libraries

    Here are some of the python libraries that are commonly used in conjunction with OpenCV:

    Numpy: Fundamental package for scientific computing

    1

  • sudoapt-getinstallpython3-numpy

  • Matplotlib: 2D Plotting Library

    1

  • sudoapt-getinstallpython3-matplotlib

  • Troubleshooting

    ImportError: No mole named ‘cv2’

  • Did you miss the “Copying the Python dev file” step? (If you are running Python3.3+)?

  • Make sure that you downloaded the correct python-dev packages. If you are not running Python 3.5, please change the dev packages accordingly. (E.g. Python 3.4 would bepython3.4-dev)

  • Recompile the makefile of the build directory. Make sure that you delete everything in the build directory before recompiling the makefile.

  • If it still does not work, try reinstalling the required packages.

⑥ cv2从python2.7与3.5中使用

因为你是python2环境下的opencv,并不是python3环境下的,每个python版本的工具包都是独立的,需要分别安装

⑦ opencv支持python3吗

  • 安装Python3
    brew install python3
    没有homebrew的话请自行安装

  • 不要使用pip3
    一开始我使用
    pip3 install numpy
    pip3 install opencv-python
    虽然成功了,但是不能使用imshow及video相关的东西,要你何用。

  • 删除原OpenCV
    在原先CMake的build文件夹下使用
    make uninstall

  • 安装OpenCV3
    brew install opencv3 --with-contrib --with-python3 --without-python
    –with-contrib是安装额外的contrib模块。
    如果不加–without-python会报一个大意是不能同时用于python3和python2的错。

  • 等待漫长的各种下载和编译
    期间会编译gcc,花了一个半小时,也是醉了。
    有些步骤挂VPN会加速,有些反而会更慢。

  • 关于protobuf出错
    在OpenCV3的CMake阶段会报一个protobuf下载失败的错。
    使用:
    brew install protobuf
    再重新执行

  • 链接
    安装完后提示信息,大意是OpenCV3与OpenCV有很多文件冲突,所以就不把它放在/usr/local里了 blabla..
    此时虽然python里可以用了,但是c++里不行了。
    需要使用:
    brew link opencv3 --overwrite --force

  • 切换
    如果以后需要同时使用OpenCV2和OpenCV3,可以用以下命令相互切换
    brew unlink opencv3
    brew link opencv --force --overwrite

⑧ opencv可以用python3.0吗

win_amd64.whl(!!!32位的系统下载32位的包,64位的下载64位的,但是如果在64位的系统上安装了32位的python,则需下载32位的包)(opencv3.0.0对应的是opencv的版本,cp34对应的python的版本)2.使用cmd进入下载好的文件的目录,安装指令:(opencv是最后安装的)"pipinstallnumpy-1.11.0+mkl-cp35-cp35m-win_amd64.whl""pipinstallscipy-0.17.1-cp35-cp35m-win_amd64.whl""pipinstallopencv_python-3.1.0-cp35-cp35m-win_amd64.whl"3.之后把D:\python35\Lib\site-packages中那一堆opencv的dll放到一个新建的名为cv2的文件夹里4.验证:importcv2无报错

⑨ python3中能安装opencv2吗

官方不支持,建议等支持吧。 dll有自己版本对应的,必须使用专门为python3.4编译的dll(cv2.pyd),你拿python2.7的肯定用不了。 如果非要使用—— 方法一:自己编译opencv的源码 方法二:安装python2.7

⑩ 如何给Python3安装OpenCV库

试试 pip3 install opencv-python

热点内容
android的自定义属性 发布:2025-02-08 02:07:27 浏览:605
怎么看电脑的用户名和密码 发布:2025-02-08 02:02:48 浏览:794
vb动态数据库 发布:2025-02-08 02:01:53 浏览:110
一台存储可以配几个扩展柜 发布:2025-02-08 01:53:22 浏览:566
分布式存储技术优缺点 发布:2025-02-08 01:51:37 浏览:245
linuxsuse重启 发布:2025-02-08 01:49:27 浏览:412
java对称加密 发布:2025-02-08 01:48:04 浏览:523
java报表框架 发布:2025-02-08 01:47:59 浏览:930
方舟手游怎么防止踢出服务器 发布:2025-02-08 01:42:44 浏览:690
c语言中函数的声明函数 发布:2025-02-08 01:41:08 浏览:70