Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to create exe of Python Code using opencv with or without py2exe?

i have some Python Code working properly its some kinda simple thing using opencv. for example

import cv2
x = cv2.imread('Dog6.jpg')
cv2.imwrite('new2.jpg')

setup.py is

from distutils.core import setup
import py2exe
import cv2
setup(console=['name.py'])

but i am unable to create exe of this code with py2exe. is there another method to create exe of such program ?

Error is ImportError:numpy.core.multiarray failed to import

like image 363
Ayub Khan Avatar asked May 31 '13 09:05

Ayub Khan


People also ask

Can you compile Python code into exe?

Yes, it is possible to compile Python scripts into standalone executables. PyInstaller can be used to convert Python programs into stand-alone executables, under Windows, Linux, Mac OS X, FreeBSD, Solaris, and AIX. It is one of the recommended converters.


1 Answers

Put the line:

 import numpy

Into your script, i.e the first file and try again.

like image 73
Mike Müller Avatar answered Oct 17 '22 21:10

Mike Müller