[PYTHON] What to do if you install openCV3 and make a symbolic link, but when you do "import cv2", "No module named'cv2'" appears

background

As I wrote in here, I'm glad I was able to install openCV3, but I couldn't ʻimport cv2` if I put the symbolic link honestly. So I'll leave a note of the solution.

How the error came out

ln -s /usr/local/Cellar/opencv3/3.2.0/lib/python3.6/site-packages/cv2.cpython-36m-darwin.so ~/.pyenv/versions/3.5.3/lib/python3.5/site-packages

After doing this, ʻimport cv2` ...

> ipython
In [1]: import cv2
---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-1-72fbbcfe2587> in <module>()
----> 1 import cv2

ImportError: No module named 'cv2'

It will be like this.

Solution

ln -s /usr/local/Cellar/opencv3/3.2.0/lib/python3.6/site-packages/cv2.cpython-36m-darwin.so ~/.pyenv/versions/3.5.3/lib/python3.5/site-packages/cv2.so

I solved it by changing the name of the link to cv2.so.

Recommended Posts

What to do if you install openCV3 and make a symbolic link, but when you do "import cv2", "No module named'cv2'" appears
What to do if a symbolic link error occurs in import cv while trying to install OpenCV in Python
What to do if you get Swagger-codegen in python and Import Error: No module named
No module named What to do if you get'libs.resources'
ModuleNotFoundError: No module What to do if you get'tensorflow.contrib'
ImportError: No module What to do when you are told
What to do if you get a UnicodeDecodeError with pip install
What to do if "amazon-linux-extras" → "No module named amazon_linux_extras"
What to do if you get a "No versions found" error in pipenv
What to do if you are told "Import Error: cannot import name'HTTPSHandler'" when building a virtual environment using virtualenv
What to do if you can't pip install mysqlclient
What to do if you get a memory error when converting from PySparkDataFrame to PandasDataFrame
[Python] What to do when No module named'pyproj.datadir' appears when Exe is done with PyInstaller
What to do if ENOENT: no such file or directory appears during npm install
How to install and use pyenv, what to do if you can't switch python versions
What to do if you get an Import Error when importing matplotlib with Jupyter
What to do if you get the error "Error: opencv3: Does not support building both Python 2 and 3 wrappers" when installing openCV 3
What to do if you cat or tail a binary file and the terminal is garbled
What to do if you grep a text file and it becomes Binary file (standard input) matches
What to do if you get a must override `get_config` error when trying to model.save in Keras
What to do if you can't install pyaudio with pip #Python
What to do if Insecure Platform Warning appears when running Python
What to do when ModuleNotFoundError: No module named'XXX' occurs in Python
What to do if you should have set an ssh key but are prompted for a password
What to do if you get a Permission denied (public key) error when trying to pull on Github
What to do when "OS Error: [WinError 126] The specified module cannot be found" appears in import torch
[Python] What to do if you get a ModuleNotFoundError when importing pandas using Jupyter Notebook in Anaconda
[Memorandum] What to do when a warning appears after executing pip list
What to do if No Python documentation found for ... appears in pydoc
What to do if you get a TypeError with numpy min, max
What to do if you get an error when trying to load mnist
What to do if you can't install with pip in babun environment
What to do if fprintd requires a password when registering your fingerprint
What happens if you do "import A, B as C" in Python?
What to do if you get an error when installing Dlib (Ubuntu)
What to do if you get the error RuntimeError: Python is not installed as a framework when trying to use matplitlib and pylab in Python 3.3
What to do if you get an error when trying to send a message in tasks.loop () immediately after startup
What to do when a warning appears around Python integration in Neovim's CheckHealth
[Note] What to do if the Qt library conflicts between pyqt and opencv
What to do if you get an error when installing python with pyenv
What to do if abort is displayed when inputting camera video in OpenCV
What to do when [Errno 2] No such file or directory appears in Python
What to do if NotADirectoryError: [Errno 20] Not a directory:'xdg-settings' appears in jupyter notebook
What to do when you want to receive files from a Windows client remotely
What to do if you can't pipenv shell
Note: What to do if pip install fails
Import cv2 ModuleNotFoundError: No module named'cv2' in python3
What to do if you get an OpenSSL error when installing Python 2 with pyenv
What to do if you get `No kernel for language python found` in Hydrogen
What to do if pvcreate produces a lot of WARNING and cannot be created
What to do if you get an error when importing matplotlib in Python (Mac)
What to do if you don't want to use Japanese column names when using ortoolpy.logistics_network
What to do if you get the error ʻERR_FEATURE_UNAVAILABLE_ON_PLATFORM` when using ts-node-dev on Linux
What to do if you run python in IntelliJ and end with an error
What to do if you get an error when vagrant up when you enable public_network or private_network on Vagrant + Arch Linux → Install netctl
What to do if pip install fails in Xcode 5.1
[Go 1.13] What to do when unexpected directory layout: appears
[openpyxl] What to do when IllegalCharacterError appears in pandas.DataFrame.to_excel
What to do when gdal_merge creates a huge file
What to do if a UnicodeDecodeError occurs in pip
What to do when "cannot import name xxx" [Python]