Win10+Anaconda3环境下的OpenCV4.0-Python安装教程

在Ubuntu16.04环境下,进入Anaconda虚拟环境,输入

pip install opencv-python -i https://pypi.tuna.tsinghua.edu.cn/simple/

可以直接安装OpenCV 4.0了,一行代码搞定,美滋滋。

在这里插入图片描述

Win10+Anaconda3环境下的OpenCV4.0-Python安装教程

在OpenCV 3.0发布三年半之后,OpenCV 4.0终于发布了。我看了一下网上的教程都是利用Visual Studio对OpenCV源码进行编译的办法来安装的,繁琐不说,还容易出错。我尝试了一下用编译好的版本结合Anaconda3进行OpenCV4.0安装,完美支持Python2.7版本,对Python3,目前还只能在...\site-packages\opencv\build\python这个路径下运行,还请各路大神多多指点。

创建虚拟环境

首先安装Anaconda3,安装步骤不再赘述,可以参考我前面的博客Windows10 GPU版Tensorflow配置教程+Anaconda3+Jupyter Notebook

安装完之后,打开命令行,输入以下命令,创建一个虚拟环境,在里面乱搞是不会破坏外面配置好的环境的。环境的名字可以随便取,我取的是opencv40,python版本用3.5就行。

conda create -n opencv40 python=3.5

conda env list来查看已创建的所有环境,用activate opencv40来激活环境,输入conda install numpy matplotlib安装必要的package。如果安装速度慢,可以<

PS C:\Users\Administrator\Desktop\pythoncode\a-yanzhan\ConSinGAN-master> pip list Package Version ---------------------------------- ----------------- absl-py 0.9.0 alabaster 0.7.11 albumentations 0.4.3 anaconda-client 1.7.2 anaconda-navigator 1.9.2 anaconda-project 0.8.2 appdirs 1.4.3 asn1crypto 0.24.0 astroid 2.0.2 astropy 3.0.4 atomicwrites 1.2.1 attrs 18.2.0 Automat 0.7.0 Babel 2.6.0 backcall 0.1.0 backports.shutil-get-terminal-size 1.0.0 beautifulsoup4 4.6.3 bitarray 0.8.3 bkcharts 0.2 blaze 0.11.3 bleach 2.1.4 bokeh 0.13.0 boto 2.49.0 Bottleneck 1.2.1 cachetools 4.0.0 certifi 2019.11.28 cffi 1.11.5 chardet 3.0.4 click 6.7 cloudpickle 0.5.5 clyent 1.2.2 colorama 0.3.9 comtypes 1.1.7 conda 4.13.0 conda-build 3.21.9 conda-package-handling 1.8.1 constantly 15.1.0 contextlib2 0.5.5 cryptography 3.3.2 cycler 0.10.0 Cython 0.28.5 cytoolz 0.9.0.1 dask 0.19.1 datashape 0.5.4 decorator 4.4.2 defusedxml 0.5.0 distributed 1.23.1 docutils 0.14 entrypoints 0.2.3 et-xmlfile 1.0.1 fastcache 1.0.2 filelock 3.0.8 Flask 1.0.2 Flask-Cors 3.0.6 future 0.18.2 gevent 1.3.6 glob2 0.6 google-auth 1.11.3 google-auth-oauthlib 0.4.1 greenlet 0.4.15 grpcio 1.27.2 h5py 2.8.0 heapdict 1.0.0 html5lib 1.0.1 hyperlink 18.0.0 idna 2.9 imageio 2.4.1 imagesize 1.1.0 imgaug 0.2.6 incremental 17.5.0 ipykernel 4.10.0 ipython 6.5.0 ipython_genutils 0.2.0 ipywidgets 7.4.1 isort 4.3.4 itsdangerous 0.24 jdcal 1.4 jedi 0.12.1 Jinja2 2.10 joblib 0.14.1 jsonschema 2.6.0 jupyter 1.0.0 jupyter-client 5.2.3 jupyter-console 5.2.0 jupyter-core 4.4.0 jupyterlab 0.34.9 jupyterlab-launcher 0.13.1 keyring 13.2.1 kiwisolver 1.1.0 lazy-object-proxy 1.3.1 libarchive-c 5.1 llvmlite 0.24.0+1.gee50a0f locket 0.2.0 lxml 4.2.5 Markdown 3.2.1 MarkupSafe 1.0 matplotlib 3.0.3 mccabe 0.6.1 menuinst 1.4.14 mistune 0.8.3 mkl-fft 1.0.4 mkl-random 1.0.1 more-itertools 4.3.0 mpmath 1.0.0 msgpack 0.5.6 multipledispatch 0.6.0 navigator-updater 0.2.1 nbconvert 5.4.0 nbformat 4.4.0 networkx 2.4 nltk 3.3 nose 1.3.7 notebook 5.6.0 numba 0.39.0 numexpr 2.6.8 numpy 1.15.2 numpydoc 0.8.0 oauthlib 3.1.0 odo 0.5.1 olefile 0.46 opencv-python 4.2.0.32 opencv-python-headless 4.2.0.32 openpyxl 2.5.6 packaging 17.1 pandas 0.23.4 pandocfilters 1.4.2 parso 0.3.1 partd 0.3.8 path.py 11.1.0 pathlib2 2.3.2 patsy 0.5.0 pep8 1.7.1 pickleshare 0.7.4 Pillow 5.3.0 pip 24.0 pkginfo 1.4.2 pluggy 0.7.1 ply 3.11 prometheus-client 0.3.1 prompt-toolkit 1.0.15 protobuf 3.11.3 psutil 5.4.7 py 1.6.0 pyasn1 0.4.8 pyasn1-modules 0.2.8 pycodestyle 2.4.0 pycosat 0.6.3 pycparser 2.18 pycrypto 2.6.1 pycurl 7.44.1 pyflakes 2.0.0 Pygments 2.2.0 pylint 2.1.1 pyodbc 4.0.24 pyOpenSSL 18.0.0 pyparsing 2.4.6 PySocks 1.6.8 pytest 3.8.0 pytest-arraydiff 0.2 pytest-astropy 0.4.0 pytest-doctestplus 0.1.3 pytest-openfiles 0.3.0 pytest-remotedata 0.3.0 python-dateutil 2.7.3 pytz 2018.5 PyWavelets 1.1.1 pywin32 223 pywinpty 0.5.4 PyYAML 3.13 pyzmq 17.1.2 QtAwesome 0.4.4 qtconsole 4.4.1 QtPy 1.5.0 requests 2.23.0 requests-oauthlib 1.3.0 rope 0.11.0 rsa 4.0 ruamel_yaml 0.15.46 scikit-image 0.15.0 scikit-learn 0.22.2.post1 scipy 1.1.0 seaborn 0.9.0 Send2Trash 1.5.0 service-identity 17.0.0 setuptools 68.0.0 simplegeneric 0.8.1 singledispatch 3.4.0.3 six 1.14.0 snowballstemmer 1.2.1 sortedcollections 1.0.1 sortedcontainers 2.0.5 Sphinx 1.7.9 sphinxcontrib-websupport 1.1.0 spyder 3.3.1 spyder-kernels 0.2.6 SQLAlchemy 1.2.11 statsmodels 0.9.0 sympy 1.2 tables 3.4.4 tblib 1.3.2 tensorboard 2.1.0 terminado 0.8.1 testpath 0.3.1 toolz 0.9.0 tornado 5.1 tqdm 4.27.0 Twisted 18.7.0 unicodecsv 0.14.1 urllib3 1.25.8 wcwidth 0.1.7 webencodings 0.5.1 Werkzeug 1.0.0 wheel 0.31.1 widgetsnbextension 3.4.1 win_inet_pton 1.0.1 win-unicode-console 0.5 wincertstore 0.2 wrapt 1.10.11 xlrd 1.1.0 XlsxWriter 1.1.0 xlwings 0.11.8 xlwt 1.3.0 zict 0.1.3 zope.interface 4.5.0 PS C:\Users\Administrator\Desktop\pythoncode\a-yanzhan\ConSinGAN-master> nvidia-smi Fri Sep 5 11:21:23 2025 | NVIDIA-SMI 581.15 Driver Version: 581.15 CUDA Version: 13.0 | +-----------------------------------------+------------------------+----------------------+ | GPU Name Driver-Model | Bus-Id Disp.A | Volatile Uncorr. ECC | | Fan Temp Perf Pwr:Usage/Cap | Memory-Usage | GPU-Util Compute M. | | | | MIG M. | |=========================================+========================+======================| | 0 NVIDIA GeForce RTX 3060 ... WDDM | 00000000:01:00.0 Off | N/A | | N/A 41C P0 21W / 130W | 0MiB / 6144MiB | 0% Default | | | | N/A | +-----------------------------------------+------------------------+----------------------+ +-----------------------------------------------------------------------------------------+ | Processes: | | GPU GI CI PID Type Process name GPU Memory | | ID ID Usage | |=========================================================================================| | No running processes found | +-----------------------------------------------------------------------------------------+ PS C:\Users\Administrator\Desktop\pythoncode\a-yanzhan\ConSinGAN-master> python --version Python 3.7.0 这是我的python版本,pip列表,nvidia信息,我想下载合适的,版本匹配的torch以及相关依赖库,给我方法
09-06
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值