I've installed opencv
for Anaconda with this command:
conda install opencv
And when I run python3.6
in terminal , I can import cv2
module with any issue.
So opencv
has been installed for Anaconda's path successfully.
Python 3.6.1 |Anaconda custom (64-bit)| (default, May 11 2017, 13:09:58)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-1)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import cv2
But when I import cv2
in python3.5
:
Python 3.5.3 (default, Jan 19 2017, 14:11:04)
[GCC 6.3.0 20170118] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import cv2
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named 'cv2'
So I can't use opencv
in system's python.
And here is the question; how to can I import Anaconda's modules (especially cv2
) in system's python?
How to create symbolic link from Anaconda's modules to system's python path?
That's not going to work and it's not related to module search paths.
Let's assume you managed to set the correct module search path or link the path of the module
cv2
to a location in the current module search path of the system Python. Now Python 3.5.3 would try to load a native module compiled for Python 3.6.1. Unfortunately different Python versions have different ABIs (Application Binary Interface) which means that native modules compiled for one Python version tend to not work in different Python versions. This becomes more likely the greater the difference between the Python versions. A change in the number after the dot in a version string is already considered a "major" change.You need to compile and install that module again for the desired Python version and installation. See How to install OpenCV 3.1 for Python 3.5 On Ubuntu 16.04 LTS?
Add Anaconda's site-packages to PYTHONPATH:
(You'll have to adapt for your Anaconda installation and python version).
Edit: I tested with numpy which I don't have outside Anaconda. It is not guaranteed that all libraries will work, as they may be version specific.