System information (version)
- OpenCV => 4.1.0-dev
- Operating System / Platform => Ubuntu 16.04
- Compiler => clang-6.0.0
Detailed description
I installed the 4.1.0-dev version according to the installation guide in linux. https://docs.opencv.org/master/d7/d9f/tutorial_linux_install.html
After compile the latest version of opencv and install with "make install" command, we can use the following code in either python2 or python3.
import cv2
The python3 version is corrected handled, however, the python2 version runs with error:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python2.7/dist-packages/cv2/__init__.py", line 89, in <module>
bootstrap()
File "/usr/local/lib/python2.7/dist-packages/cv2/__init__.py", line 42, in bootstrap
from cv2.load_config_py2 import exec_file_wrapper
ImportError: No module named load_config_py2
I found the code in load_config_py2 are as follows.
41 if sys.version_info[:2] < (3, 0):
42 from cv2.load_config_py2 import exec_file_wrapper
43 else:
44 from . load_config_py3 import exec_file_wrapper
If I change the code in line 42 to
from . load_config_py2 import exec_file_wrapper
then the import will be correct.
Steps to reproduce
Build opencv as https://docs.opencv.org/master/d7/d9f/tutorial_linux_install.html in ubuntu.
$sudo make install
$python2
>>> import cv2
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python2.7/dist-packages/cv2/__init__.py", line 89, in <module>
bootstrap()
File "/usr/local/lib/python2.7/dist-packages/cv2/__init__.py", line 42, in bootstrap
from cv2.load_config_py2 import exec_file_wrapper
ImportError: No module named load_config_py2
System information (version)
Detailed description
I installed the 4.1.0-dev version according to the installation guide in linux. https://docs.opencv.org/master/d7/d9f/tutorial_linux_install.html
After compile the latest version of opencv and install with "make install" command, we can use the following code in either python2 or python3.
import cv2The python3 version is corrected handled, however, the python2 version runs with error:
I found the code in load_config_py2 are as follows.
If I change the code in line 42 to
from . load_config_py2 import exec_file_wrapperthen the import will be correct.
Steps to reproduce
Build opencv as https://docs.opencv.org/master/d7/d9f/tutorial_linux_install.html in ubuntu.
$sudo make install$python2>>> import cv2