Search code examples
bashpython-3.xopencvcx-freeze

Dynamic Shared Library error when creating exe from cx_freeze


I have a python file using OpenCV library.I want this in as an executable file.

Came across this cx_freeze

Example:

ABC.py(file using opencv library)

Content of setup.py is given below

from cx_Freeze import setup, Executable

setup(  name = "ABC",
        version = "0.1",
        description = "Testing",
        executables = [Executable("ABC.py")],
)

I ran this command in the terminal

python setup.py install

It is stopping after showing this error message

copying /Users/name/.virtualenvs/test/lib/python3.6/site-packages/cv2.so -> build/exe.macosx-10.12-x86_64-3.6/lib/cv2.so
copying /Users/name/.virtualenvs/test/bin/../lib/libopencv_reg.3.3.dylib -> build/exe.macosx-10.12-x86_64-3.6/libopencv_reg.3.3.dylib
error: [Errno 2] No such file or directory: '/Users/name/.virtualenvs/test/bin/../lib/libopencv_reg.3.3.dylib'

I know from the error message that libopencv_reg.3.3.dylib is not found.

I'm running this on a python virtual environment. This is my bash_profile content

#Homebrew
export PATH=/usr/local/bin:$PATH

#export WORKON_HOME=$HOME/.virtualenvs

# Virtualenv/VirtualenvWrapper
source /usr/local/bin/virtualenvwrapper.sh
#export PROJECT_HOME=$HOME/Devel
#export VIRTUALENVWRAPPER_PYTHON=/usr/local/bin/python
#export VIRTUALENVWRAPPER_VIRTUALENV=/usr/local/bin/virtualenv
#export VIRTUALENVWRAPPER_VIRTUALENV_ARGS='--no-site-packages'

I'm confused please help me out fix this. Guidance would really be helpful, if this question can be posted else where let me know rather than down voting it.


Solution

  • Shared the same on OpenCV forum

    here's the response I got there

    Looks like we have build OpenCV in such a way that other shared objects(.so) files are not dependent.