How do I get opencv for python3 with anaconda3? - python

So, initially, I just had python 3.5 from the anaconda installation and all was fine. Then I was following a tutorial that suggested the use of enthought canopy, which used python 2.7.
After this I did a 'pip install opencv-python' and that installed the 2.7 version of the library. I should note, I am on Ubunutu 16 desktop for development.
I cannot seem to find a way for installing opencv and possibly cv2 for python3, the version installed in my user directory. Maybe I should remove enthought canopy. But I will still need to find the correct versions of opencv, cv2 for anaconda3.
Thanks in advance for any help,
Bruce

Once you have anaconda installed, try the following (as seen in this tutorial):
conda create -n opencv numpy scipy scikit-learn matplotlib python=3
source activate opencv
conda install -c https://conda.binstar.org/menpo opencv3
it will first create a virtual environment called opencv with the packages opencv, numpy, scipy, scikit-learn and matplotlib.
It works for me on Mac.

Related

How to upgrade OpenCV in Anaconda (windows)?

everyone.
My problem is that I need the last version of OpenCV (4.3.0) to run a code but when I checked my version of opencv with the line:
print(cv2.__version__)
it said that my version of cv2 is the 3.4.2. So I went into my anaconda, environment, I marked opencv for upgrade, but it seems it is the last version it can install. So I tried a command in the cmd.prompt of anaconda :
pip install --upgrade opencv-python==4.3.0.36
And then, when I checked "opencv" in the installed modules of my anaconda environment, I saw two opencv. One is "opencv" version 3.4.2, and then, just below, there is "opencv-pyton" version 4.3.0. BUT, when I checked again my version of cv2 with "print(cv2.version)", it was still telling me that my version is 3.4.2 (I also tried to uninstall the opencv 3.4.2 to see if anaconda would then take into account the opencv-pyton 4.3.0 but no, it gives me an error).
Does anyone have an idea how to upgrade my version of opencv with anaconda ? Thanks everyone.
You may be missing the conda-forge channel in your .condarc settings.
try this to install from conda-forge:
conda install -c conda-forge opencv=4.3.0

Biopython Package not recognized even when installed

I ran pip3 install biopython and it seemed to have been installed correctly
But when I try to run it in ipython or python3 for example
I'm quite confused because if I do the same thing with numpy or sklearn it works perfectly. Any ideas?
Notice that your environment you are using to run Python (second image) is using the Anaconda Python Distribution.
When you are installing using the command in the first image you are installing in the Python3 environment but not in the Anaconda Distribution environment.
Try running the following command to install the package in Anaconda:
conda install biopython

Opencv python package manage

Recently I used opencv Python to handle Video Steam.
Normally I should install opencv-python via pip.
However I found that the opencv-python in pypi is unofficial package.
And it's just a package with opencv core, which does NOT including packages like contrib and FFmpeg...
If you wanted a version of opencv with extra packages, you should possibly download the opencv source code and build your own Opencv Python Bindings.
For me, this is not a friendly way to manage Opencv compared to other python libs in pypi.
Does anyone have a more elegant way to manage opencv python in both Mac and Linux OS please?
if u have anaconda then just open anaconda prompt and you can try
conda install -c conda-forge opencv
or for opencv 3 version you can try
conda install -c menpo opencv3
The easies way to install opencv-python is link or this link.
pip install will just install opencv-core, which does not include FFmpeg lib...

Install `opencv_contrib` on Windows for Python via Anaconda

My computer is running Windows 10, and I have installed OpenCV 3.2.0 with Python 2.7.
I want to use the opencv_contrib repository.
Does anyone know how to acheive this via Anaconda?
You can try conda installing this OpenCV package from a community channel: https://anaconda.org/jlaura/OpenCV3. It should come with the extra OpenCV modules.
You can also try pip installing opencv-contrib-python into your Anaconda environment (you may want to remove OpenCV first):
pip install opencv-contrib-python

how to install python3.5 completely and remove python2.7 on Mac?

I have installed python3.5 with commands:
sudo apt-get install python3.5
after
pip install matplotlib
pip install numpy
pip install scikit-learn
It works but only on python2.7.6 installed by default. When I type "python",it show me the interactive shell of python2.7.6. I can use python3.5 by type "python3",but i can't import some library i install such as numpy, scikit-learn, matplotlib but it works in 2.7.6.
How to use all my libraries i install with python3.5 instead of 2.7.6?
pip3 will ensure you're installing packages for python3 if there's confusion with a Python 2.x installed on the same machine.
I figure out the best way to deal with it i think. I download Anaconda from this link (https://www.continuum.io/downloads). Anaconda integrates many academic libraries by default so I choose to download anaconda with the Python 3 version and all libraries going with. So now I can use it in PyCharm.
So creating a new project, I just have to choose the rep of python in my anaconda folder.
Thanks guys.

Categories