Check items when the imported python module does not work as expected

Sometimes when I imported a module that was python, it didn't work as expected. At that time, I checked the following items. Write in cv2 as an example.

-[] Check the version of python started by the python command

Linux $ which python

-[] Check the path where the python third party module is located -[] Check the version of the imported module

>>> import cv2
>>> cv2.__version__
'2.4.11'

-[] Check the file name of the imported module

>>> cv2.__file__
'C:\\Python27\\lib\\site-packages\\cv2.pyd'

You can check if an unintended version is running by doing such a check.


Further necessary check items --Conditions when building the library --Are you using OpenMP? --Are you using Cuda? --Other build conditions

>>> print cv2.getBuildInformation()

General configuration for OpenCV 2.4.11 =====================================
  Version control:               2.4.11

  Platform:
    Host:                        Windows 6.1 AMD64
    CMake:                       2.8.11.2
    CMake generator:             Visual Studio 10
    CMake build tool:            C:/Windows/Microsoft.NET/Framework/v4.0.30319/MSBuild.exe
    MSVC:                        1600

  C/C++:
    Built as dynamic libs?:      NO
(Omitted below)

  Other third-party libraries:
    Use IPP:                     NO
    Use Eigen:                   NO
    Use TBB:                     NO
    Use OpenMP:                  NO
    Use GCD                      NO
    Use Concurrency              YES
    Use C=:                      NO
    Use Cuda:                    NO
    Use OpenCL:                  YES

Recommended Posts

Check items when the imported python module does not work as expected
An error that does not work as expected when calling the tkinter module in a text editor
Check when the version does not switch with pyenv
Check when the Docker container does not connect to the Internet
Check the behavior when assigning Python
When the program pip installed on Mac / Marvericks does not work
Pass the path of the imported python module
[VScode] autopep8 format does not work [Python]
Virtualenv does not work on Python3.5 (Windows)
Python> Python does not include the last offset
Check points when MIDI does not work in a program using SDL_mixer
Processing when the key input of Python pygame does not go well.
Example of what to do when the sample script does not work (OpenCV-Python)
I managed to solve the situation where Python does not work on Mac
After installing php7.2, the php command does not work
Jinja2 2.9.6 does not work on Lambda Python 3 series
When wildcard specification does not work with pylint
Patch when full text search does not work in GAE / Python local environment
What to do when python3 type venv does not work well on Raspberry Pi
[Python] Precautions when it does not work even if TimedRotatingFileHandler is set in basicConfig in python2
Solution when Linux does not recognize the built-in camera
Command when ACPI shutdown does not work in VirtualBox
Master the type in Python? (When should type check be done)
The story that `while queue` did not work in python
Solve the Japanese problem when using the CSV module in Python.
[VSCode] unable to import'google.cloud' What to do when pylint (import-error) does not recognize the Python import statement
A story that didn't work when I tried to log in with the Python requests module
About the Python module venv
Python version does not switch
[Python] Check the installed libraries
When incrementing the value of a key that does not exist
Dtype is the reason why Numpy's assert_array_equal doesn't work as expected
Solution when background-cover of Linux version VS Code does not work
Tkinter canvas (window) does not start when running Python 3.7.4 with Atom
The story of the release work of the application that Google does not tell
The story that 2D list replacement did not work in python
Build Python environment on Ubuntu (when pip is not the default)