Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

A configuration problem of OpenCV4

I built the OpenCV4 by Cmake and installed the opecv4.0 using anaconda3 with its python 3.7 verison. My platform is Ubuntu 18.04 LTS. However, when testing the installation, I encounter the following problem:

ype "help", "copyright", "credits" or "license" for more information.
>>> import cv2
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/user/anaconda3/lib/python3.7/site-packages/cv2/__init__.py", line 89, in <module>
    bootstrap()
  File "/home/user/anaconda3/lib/python3.7/site-packages/cv2/__init__.py", line 62, in bootstrap
    ], True)
  File "/home/user/anaconda3/lib/python3.7/site-packages/cv2/__init__.py", line 56, in load_first_config
    raise ImportError('OpenCV loader: missing configuration file: {}. Check OpenCV installation.'.format(fnames))
ImportError: OpenCV loader: missing configuration file: ['config-3.7.py', 'config-3.py']. Check OpenCV installation.
>>>

I typed the command:

echo $PYTHONPATH

I get:

/home/user/anaconda3/lib/python3.7/site-packages

Please help. Thanks.

click to hide/show revision 2
retagged

updated 2019-11-18 10:04:09 -0600

berak gravatar image

A configuration problem of OpenCV4

I built the OpenCV4 by Cmake and installed the opecv4.0 using anaconda3 with its python 3.7 verison. My platform is Ubuntu 18.04 LTS. However, when testing the installation, I encounter the following problem:

ype "help", "copyright", "credits" or "license" for more information.
>>> import cv2
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/user/anaconda3/lib/python3.7/site-packages/cv2/__init__.py", line 89, in <module>
    bootstrap()
  File "/home/user/anaconda3/lib/python3.7/site-packages/cv2/__init__.py", line 62, in bootstrap
    ], True)
  File "/home/user/anaconda3/lib/python3.7/site-packages/cv2/__init__.py", line 56, in load_first_config
    raise ImportError('OpenCV loader: missing configuration file: {}. Check OpenCV installation.'.format(fnames))
ImportError: OpenCV loader: missing configuration file: ['config-3.7.py', 'config-3.py']. Check OpenCV installation.
>>>

I typed the command:

echo $PYTHONPATH

I get:

/home/user/anaconda3/lib/python3.7/site-packages

Please help. Thanks.

A configuration problem of OpenCV4

I built the OpenCV4 by Cmake and installed the opecv4.0 using anaconda3 with its python 3.7 verison. My platform is Ubuntu 18.04 LTS. However, when testing the installation, I encounter the following problem:

ype "help", "copyright", "credits" or "license" for more information.
>>> import cv2
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/user/anaconda3/lib/python3.7/site-packages/cv2/__init__.py", line 89, in <module>
    bootstrap()
  File "/home/user/anaconda3/lib/python3.7/site-packages/cv2/__init__.py", line 62, in bootstrap
    ], True)
  File "/home/user/anaconda3/lib/python3.7/site-packages/cv2/__init__.py", line 56, in load_first_config
    raise ImportError('OpenCV loader: missing configuration file: {}. Check OpenCV installation.'.format(fnames))
ImportError: OpenCV loader: missing configuration file: ['config-3.7.py', 'config-3.py']. Check OpenCV installation.
>>>

I typed the command:

echo $PYTHONPATH

I get:

/home/user/anaconda3/lib/python3.7/site-packages

Updated:

I found that the /home/user/anaconda3/lib/python3.7/site-packages/cv2/ does not contain the config-3.7.py, but it contains config-3.6.py. At the beginning, I ensured that all python3 are correlated to the anaconda's python 3.7 library. I don't know why the cv2 folder still uses the Ubuntu's default python.

I have tried deleting the cv2 folder and rebuild it again, but it still generates the config-3.6.py file. I don't know why it will like this.

By the way, I didn't turn on the opencv python3 verison in Cmake config of building OpenCV, will it be affected?

Please help. Thanks.Thanks

A configuration problem of OpenCV4

I built the OpenCV4 by Cmake and installed the opecv4.0 using anaconda3 with its python 3.7 verison. My platform is Ubuntu 18.04 LTS. However, when testing the installation, I encounter the following problem:

ype "help", "copyright", "credits" or "license" for more information.
>>> import cv2
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/user/anaconda3/lib/python3.7/site-packages/cv2/__init__.py", line 89, in <module>
    bootstrap()
  File "/home/user/anaconda3/lib/python3.7/site-packages/cv2/__init__.py", line 62, in bootstrap
    ], True)
  File "/home/user/anaconda3/lib/python3.7/site-packages/cv2/__init__.py", line 56, in load_first_config
    raise ImportError('OpenCV loader: missing configuration file: {}. Check OpenCV installation.'.format(fnames))
ImportError: OpenCV loader: missing configuration file: ['config-3.7.py', 'config-3.py']. Check OpenCV installation.
>>>

I typed the command:

echo $PYTHONPATH

I get:

/home/user/anaconda3/lib/python3.7/site-packages

Updated:

I found that the /home/user/anaconda3/lib/python3.7/site-packages/cv2/ does not contain the config-3.7.py, but it contains config-3.6.py. At the beginning, I ensured that all python3 are correlated to the anaconda's python 3.7 library. I don't know why the cv2 folder still uses the Ubuntu's default python.

I have tried deleting the cv2 folder and rebuild it again, but it still generates the config-3.6.py file. I don't know why it will like this.

By the way, I didn't turn on the opencv python3 verison in Cmake config of building OpenCV, will it be affected?

Please help. Thanks

A part of Cmake is here: Cmake

A configuration problem of OpenCV4

I built the OpenCV4 by Cmake and installed the opecv4.0 using anaconda3 with its python 3.7 verison. My platform is Ubuntu 18.04 LTS. However, when testing the installation, I encounter the following problem:

ype "help", "copyright", "credits" or "license" for more information.
>>> import cv2
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/user/anaconda3/lib/python3.7/site-packages/cv2/__init__.py", line 89, in <module>
    bootstrap()
  File "/home/user/anaconda3/lib/python3.7/site-packages/cv2/__init__.py", line 62, in bootstrap
    ], True)
  File "/home/user/anaconda3/lib/python3.7/site-packages/cv2/__init__.py", line 56, in load_first_config
    raise ImportError('OpenCV loader: missing configuration file: {}. Check OpenCV installation.'.format(fnames))
ImportError: OpenCV loader: missing configuration file: ['config-3.7.py', 'config-3.py']. Check OpenCV installation.
>>>

I typed the command:

echo $PYTHONPATH

I get:

/home/user/anaconda3/lib/python3.7/site-packages

Updated:

I found that the /home/user/anaconda3/lib/python3.7/site-packages/cv2/ does not contain the config-3.7.py, but it contains config-3.6.py. At the beginning, I ensured that all python3 are correlated to the anaconda's python 3.7 library. I don't know why the cv2 folder still uses the Ubuntu's default python.

I have tried deleting the cv2 folder and rebuild it again, but it still generates the config-3.6.py file. I don't know why it will like this.

By the way, I didn't turn on the opencv python3 verison in Cmake config of building OpenCV, will it be affected?

Please help. Thanks

A part of Cmake is here: Cmake

After modifying the Cmake config following the instruction from , I clear the build folder and rebuilt again. But the cv2 folder still contain the config-3.6.py. When I typed pip3 install --upgrade opencv-python, other errors form:

Error initializing plugin EntryPoint('Windows (alt)', 'keyrings.alt.Windows', None, Distribution('keyrings.alt', '3.0')).
Traceback (most recent call last):
  File "/home/user/anaconda3/lib/python3.7/site-packages/keyring/backend.py", line 194, in _load_plugins
    init_func = ep.load()
  File "/home/user/anaconda3/lib/python3.7/site-packages/entrypoints.py", line 82, in load
    mod = import_module(self.module_name)
  File "/usr/lib/python3.6/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 994, in _gcd_import
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 678, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/usr/lib/python3/dist-packages/keyrings/alt/Windows.py", line 9, in <module>
    from . import file_base
  File "/usr/lib/python3/dist-packages/keyrings/alt/file_base.py", line 13, in <module>
    from keyring.util.escape import escape as escape_for_ini
ModuleNotFoundError: No module named 'keyring.util.escape'
Error initializing plugin EntryPoint('file', 'keyrings.alt.file', None, Distribution('keyrings.alt', '3.0')).
Traceback (most recent call last):
  File "/home/user/anaconda3/lib/python3.7/site-packages/keyring/backend.py", line 194, in _load_plugins
    init_func = ep.load()
  File "/home/user/anaconda3/lib/python3.7/site-packages/entrypoints.py", line 82, in load
    mod = import_module(self.module_name)
  File "/usr/lib/python3.6/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 994, in _gcd_import
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 678, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/usr/lib/python3/dist-packages/keyrings/alt/file.py", line 11, in <module>
    from keyring.util.escape import escape as escape_for_ini
ModuleNotFoundError: No module named 'keyring.util.escape'
Error initializing plugin EntryPoint('pyfs', 'keyrings.alt.pyfs', None, Distribution('keyrings.alt', '3.0')).
Traceback (most recent call last):
  File "/home/user/anaconda3/lib/python3.7/site-packages/keyring/backend.py", line 194, in _load_plugins
    init_func = ep.load()
  File "/home/user/anaconda3/lib/python3.7/site-packages/entrypoints.py", line 82, in load
    mod = import_module(self.module_name)
  File "/usr/lib/python3.6/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 994, in _gcd_import
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 678, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/usr/lib/python3/dist-packages/keyrings/alt/pyfs.py", line 8, in <module>
    from keyring.util.escape import escape as escape_for_ini
ModuleNotFoundError: No module named 'keyring.util.escape'
Traceback (most recent call last):
  File "/usr/local/bin/pip3", line 7, in <module>
    from pip._internal.main import main
ModuleNotFoundError: No module named 'pip._internal.main'

A configuration problem of OpenCV4

I built the OpenCV4 by Cmake and installed the opecv4.0 using anaconda3 with its python 3.7 verison. My platform is Ubuntu 18.04 LTS. However, when testing the installation, I encounter the following problem:

ype "help", "copyright", "credits" or "license" for more information.
>>> import cv2
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/user/anaconda3/lib/python3.7/site-packages/cv2/__init__.py", line 89, in <module>
    bootstrap()
  File "/home/user/anaconda3/lib/python3.7/site-packages/cv2/__init__.py", line 62, in bootstrap
    ], True)
  File "/home/user/anaconda3/lib/python3.7/site-packages/cv2/__init__.py", line 56, in load_first_config
    raise ImportError('OpenCV loader: missing configuration file: {}. Check OpenCV installation.'.format(fnames))
ImportError: OpenCV loader: missing configuration file: ['config-3.7.py', 'config-3.py']. Check OpenCV installation.
>>>

I typed the command:

echo $PYTHONPATH

I get:

/home/user/anaconda3/lib/python3.7/site-packages

Updated:

I found that the /home/user/anaconda3/lib/python3.7/site-packages/cv2/ does not contain the config-3.7.py, but it contains config-3.6.py. At the beginning, I ensured that all python3 are correlated to the anaconda's python 3.7 library. I don't know why the cv2 folder still uses the Ubuntu's default python.

I have tried deleting the cv2 folder and rebuild it again, but it still generates the config-3.6.py file. I don't know why it will like this.

By the way, I didn't turn on the opencv python3 verison in Cmake config of building OpenCV, will it be affected?

Please help. Thanks

A part of Cmake is here: Cmake

After modifying the Cmake config following the instruction from and removing python2 related setting , I clear the build folder and rebuilt again. But the cv2 folder still contain the config-3.6.py. When I typed pip3 install --upgrade opencv-python, other errors form:

Error initializing plugin EntryPoint('Windows (alt)', 'keyrings.alt.Windows', None, Distribution('keyrings.alt', '3.0')).
Traceback (most recent call last):
  File "/home/user/anaconda3/lib/python3.7/site-packages/keyring/backend.py", line 194, in _load_plugins
    init_func = ep.load()
  File "/home/user/anaconda3/lib/python3.7/site-packages/entrypoints.py", line 82, in load
    mod = import_module(self.module_name)
  File "/usr/lib/python3.6/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 994, in _gcd_import
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 678, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/usr/lib/python3/dist-packages/keyrings/alt/Windows.py", line 9, in <module>
    from . import file_base
  File "/usr/lib/python3/dist-packages/keyrings/alt/file_base.py", line 13, in <module>
    from keyring.util.escape import escape as escape_for_ini
ModuleNotFoundError: No module named 'keyring.util.escape'
Error initializing plugin EntryPoint('file', 'keyrings.alt.file', None, Distribution('keyrings.alt', '3.0')).
Traceback (most recent call last):
  File "/home/user/anaconda3/lib/python3.7/site-packages/keyring/backend.py", line 194, in _load_plugins
    init_func = ep.load()
  File "/home/user/anaconda3/lib/python3.7/site-packages/entrypoints.py", line 82, in load
    mod = import_module(self.module_name)
  File "/usr/lib/python3.6/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 994, in _gcd_import
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 678, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/usr/lib/python3/dist-packages/keyrings/alt/file.py", line 11, in <module>
    from keyring.util.escape import escape as escape_for_ini
ModuleNotFoundError: No module named 'keyring.util.escape'
Error initializing plugin EntryPoint('pyfs', 'keyrings.alt.pyfs', None, Distribution('keyrings.alt', '3.0')).
Traceback (most recent call last):
  File "/home/user/anaconda3/lib/python3.7/site-packages/keyring/backend.py", line 194, in _load_plugins
    init_func = ep.load()
  File "/home/user/anaconda3/lib/python3.7/site-packages/entrypoints.py", line 82, in load
    mod = import_module(self.module_name)
  File "/usr/lib/python3.6/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 994, in _gcd_import
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 678, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/usr/lib/python3/dist-packages/keyrings/alt/pyfs.py", line 8, in <module>
    from keyring.util.escape import escape as escape_for_ini
ModuleNotFoundError: No module named 'keyring.util.escape'
Traceback (most recent call last):
  File "/usr/local/bin/pip3", line 7, in <module>
    from pip._internal.main import main
ModuleNotFoundError: No module named 'pip._internal.main'

A configuration problem of OpenCV4

I built the OpenCV4 by Cmake and installed the opecv4.0 using anaconda3 with its python 3.7 verison. My platform is Ubuntu 18.04 LTS. However, when testing the installation, I encounter the following problem:

ype "help", "copyright", "credits" or "license" for more information.
>>> import cv2
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/user/anaconda3/lib/python3.7/site-packages/cv2/__init__.py", line 89, in <module>
    bootstrap()
  File "/home/user/anaconda3/lib/python3.7/site-packages/cv2/__init__.py", line 62, in bootstrap
    ], True)
  File "/home/user/anaconda3/lib/python3.7/site-packages/cv2/__init__.py", line 56, in load_first_config
    raise ImportError('OpenCV loader: missing configuration file: {}. Check OpenCV installation.'.format(fnames))
ImportError: OpenCV loader: missing configuration file: ['config-3.7.py', 'config-3.py']. Check OpenCV installation.
>>>

I typed the command:

echo $PYTHONPATH

I get:

/home/user/anaconda3/lib/python3.7/site-packages

Updated:

I found that the /home/user/anaconda3/lib/python3.7/site-packages/cv2/ does not contain the config-3.7.py, but it contains config-3.6.py. At the beginning, I ensured that all python3 are correlated to the anaconda's python 3.7 library. I don't know why the cv2 folder still uses the Ubuntu's default python.

I have tried deleting the cv2 folder and rebuild it again, but it still generates the config-3.6.py file. I don't know why it will like this.

By the way, I didn't turn on the opencv python3 verison in Cmake config of building OpenCV, will it be affected?

Please help. Thanks

A part of Cmake is here: Cmake

After modifying the Cmake config following the instruction from and removing python2 related setting , I clear the build folder and rebuilt again. But I did pip3 install --upgrade, but the cv2 folder still contain the config-3.6.py. When I typed pip3 install --upgrade opencv-python, other errors form:

Error initializing plugin EntryPoint('Windows (alt)', 'keyrings.alt.Windows', None, Distribution('keyrings.alt', '3.0')).
Traceback (most recent call last):
  File "/home/user/anaconda3/lib/python3.7/site-packages/keyring/backend.py", line 194, in _load_plugins
    init_func = ep.load()
  File "/home/user/anaconda3/lib/python3.7/site-packages/entrypoints.py", line 82, in load
    mod = import_module(self.module_name)
  File "/usr/lib/python3.6/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 994, in _gcd_import
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 678, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/usr/lib/python3/dist-packages/keyrings/alt/Windows.py", line 9, in <module>
    from . import file_base
  File "/usr/lib/python3/dist-packages/keyrings/alt/file_base.py", line 13, in <module>
    from keyring.util.escape import escape as escape_for_ini
ModuleNotFoundError: No module named 'keyring.util.escape'
Error initializing plugin EntryPoint('file', 'keyrings.alt.file', None, Distribution('keyrings.alt', '3.0')).
Traceback (most recent call last):
  File "/home/user/anaconda3/lib/python3.7/site-packages/keyring/backend.py", line 194, in _load_plugins
    init_func = ep.load()
  File "/home/user/anaconda3/lib/python3.7/site-packages/entrypoints.py", line 82, in load
    mod = import_module(self.module_name)
  File "/usr/lib/python3.6/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 994, in _gcd_import
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 678, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/usr/lib/python3/dist-packages/keyrings/alt/file.py", line 11, in <module>
    from keyring.util.escape import escape as escape_for_ini
ModuleNotFoundError: No module named 'keyring.util.escape'
Error initializing plugin EntryPoint('pyfs', 'keyrings.alt.pyfs', None, Distribution('keyrings.alt', '3.0')).
Traceback (most recent call last):
  File "/home/user/anaconda3/lib/python3.7/site-packages/keyring/backend.py", line 194, in _load_plugins
    init_func = ep.load()
  File "/home/user/anaconda3/lib/python3.7/site-packages/entrypoints.py", line 82, in load
    mod = import_module(self.module_name)
  File "/usr/lib/python3.6/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 994, in _gcd_import
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 678, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/usr/lib/python3/dist-packages/keyrings/alt/pyfs.py", line 8, in <module>
    from keyring.util.escape import escape as escape_for_ini
ModuleNotFoundError: No module named 'keyring.util.escape'
Traceback (most recent call last):
  File "/usr/local/bin/pip3", line 7, in <module>
    from pip._internal.main import main
ModuleNotFoundError: No module named 'pip._internal.main'
config-3.6.py.

A configuration problem of OpenCV4

I built the OpenCV4 by Cmake and installed the opecv4.0 using anaconda3 with its python 3.7 verison. My platform is Ubuntu 18.04 LTS. However, when testing the installation, I encounter the following problem:

ype "help", "copyright", "credits" or "license" for more information.
>>> import cv2
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/user/anaconda3/lib/python3.7/site-packages/cv2/__init__.py", line 89, in <module>
    bootstrap()
  File "/home/user/anaconda3/lib/python3.7/site-packages/cv2/__init__.py", line 62, in bootstrap
    ], True)
  File "/home/user/anaconda3/lib/python3.7/site-packages/cv2/__init__.py", line 56, in load_first_config
    raise ImportError('OpenCV loader: missing configuration file: {}. Check OpenCV installation.'.format(fnames))
ImportError: OpenCV loader: missing configuration file: ['config-3.7.py', 'config-3.py']. Check OpenCV installation.
>>>

I typed the command:

echo $PYTHONPATH

I get:

/home/user/anaconda3/lib/python3.7/site-packages

Updated:

I found that the /home/user/anaconda3/lib/python3.7/site-packages/cv2/ does not contain the config-3.7.py, but it contains config-3.6.py. At the beginning, I ensured that all python3 are correlated to the anaconda's python 3.7 library. I don't know why the cv2 folder still uses the Ubuntu's default python.

I have tried deleting the cv2 folder and rebuild it again, but it still generates the config-3.6.py file. I don't know why it will like this.

By the way, I didn't turn on the opencv python3 verison in Cmake config of building OpenCV, will it be affected?

Please help. Thanks

A part of Cmake is here: Cmake

After modifying the Cmake config following the instruction from and removing python2 related setting , I clear the build folder and rebuilt again. I did pip3 install --upgrade, but the cv2 folder still contain the config-3.6.py.

Second update:

I have upgrade my Ubuntu's python to 3.7 according to this tutorial ((http://ubuntuhandbook.org/index.php/2019/02/install-python-3-7-ubuntu-18-04/)) and run this command "sudo apt-get install python3.7-dev" . The above errors disappear and the command "import cv2" can run now. But I find some special pointing locations when installing OpenCV4.1. The python3 library used is User's library instead of Anaconda's.

--   Python 2:
--     Interpreter:                 (ver 2.7.15)
--     Libraries:                   NO
--     numpy:                       NO (Python wrappers can not be generated)
--     install path:                -
-- 
--   Python 3:
--     Interpreter:                 /home/user/anaconda3/bin/python3.7m (ver 3.7.5)
--     Libraries:                   /usr/lib/x86_64-linux-gnu/libpython3.7m.so (ver 3.7.5)
--     numpy:                       /home/user/anaconda3/lib/python3.7/site-packages/numpy/core/include (ver )
--     install path:                /home/user/anaconda3/lib/python3.7/site-packages/cv2/python-3.7
-- 
--   Python (for build):            /home/user/anaconda3/bin/python3.7m

A configuration problem of OpenCV4

I built the OpenCV4 by Cmake and installed the opecv4.0 using anaconda3 with its python 3.7 verison. My platform is Ubuntu 18.04 LTS. However, when testing the installation, I encounter the following problem:

ype "help", "copyright", "credits" or "license" for more information.
>>> import cv2
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/user/anaconda3/lib/python3.7/site-packages/cv2/__init__.py", line 89, in <module>
    bootstrap()
  File "/home/user/anaconda3/lib/python3.7/site-packages/cv2/__init__.py", line 62, in bootstrap
    ], True)
  File "/home/user/anaconda3/lib/python3.7/site-packages/cv2/__init__.py", line 56, in load_first_config
    raise ImportError('OpenCV loader: missing configuration file: {}. Check OpenCV installation.'.format(fnames))
ImportError: OpenCV loader: missing configuration file: ['config-3.7.py', 'config-3.py']. Check OpenCV installation.
>>>

I typed the command:

echo $PYTHONPATH

I get:

/home/user/anaconda3/lib/python3.7/site-packages

Updated:

I found that the /home/user/anaconda3/lib/python3.7/site-packages/cv2/ does not contain the config-3.7.py, but it contains config-3.6.py. At the beginning, I ensured that all python3 are correlated to the anaconda's python 3.7 library. I don't know why the cv2 folder still uses the Ubuntu's default python.

I have tried deleting the cv2 folder and rebuild it again, but it still generates the config-3.6.py file. I don't know why it will like this.

By the way, I didn't turn on the opencv python3 verison in Cmake config of building OpenCV, will it be affected?

Please help. Thanks

A part of Cmake is here: Cmake

After modifying the Cmake config following the instruction from and removing python2 related setting , I clear the build folder and rebuilt again. I did pip3 install --upgrade, but the cv2 folder still contain the config-3.6.py.

Second update:

I have upgrade my upgraded the Ubuntu's python Python from 3.6 to 3.7 according to this tutorial ((http://ubuntuhandbook.org/index.php/2019/02/install-python-3-7-ubuntu-18-04/)) and run this command "sudo apt-get install python3.7-dev" . The above errors disappear and the command "import cv2" can run now. But I find some special pointing locations when installing OpenCV4.1. The python3 library used is User's library instead of Anaconda's.

--   Python 2:
--     Interpreter:                 (ver 2.7.15)
--     Libraries:                   NO
--     numpy:                       NO (Python wrappers can not be generated)
--     install path:                -
-- 
--   Python 3:
--     Interpreter:                 /home/user/anaconda3/bin/python3.7m (ver 3.7.5)
--     Libraries:                   /usr/lib/x86_64-linux-gnu/libpython3.7m.so (ver 3.7.5)
--     numpy:                       /home/user/anaconda3/lib/python3.7/site-packages/numpy/core/include (ver )
--     install path:                /home/user/anaconda3/lib/python3.7/site-packages/cv2/python-3.7
-- 
--   Python (for build):            /home/user/anaconda3/bin/python3.7m