Python 으로 만든 모듈을 실행 파일로 만들기 위해서 기존에는 py2exe, py2app 와 같은 툴을 사용했었는데요.

 

최근에 cx_Freeze 라는 툴도 있다는 걸 알게됐습니다.

 

cx_Freeze 는 cross platform 툴인데요~

 

요즘 주로 사용하는 윈도우 7 64 비트에서도 정상적으로 동작하더군요.

 

일단 설치는 pip 가 설치되어 있다면 다음과 같이 하면 설치되더군요.

 

pip install cx_Freeze

 

pip 가 설치되어 있지 않은 분들은 아래 글 참조하여 설치하시기 바랍니다.


http://iamaman.tistory.com/984

http://iamaman.tistory.com/m/post/997


 

아래는 다른 블로그에서 봤던 sqrt.py 파일인데요~ 간단하게 sqrt() 값을 계산해 주는 겁니다.

 

import math

sqrt=math.sqrt

x=int(input('enter the number here:'))

 

y=sqrt(x)

print(y)

input('press exit')

 

실행할 파이썬 모듈 파일을 만든 다음에 setup.py 파일을 작성해 줍니다.

위 코드에서 create_shared_zip 을 False 로 함으로서 library.zip 파일을 생성하지 않게 할 수 있습니다.

 

다음으로 command 창에서 간단하게 아래 그림과 같이 setup.py build 라는 명령어를 치면~ build 폴더 안에 ~ sqrt.exe 라는 이름의 실행 파일이 만들어집니다.

 

Sqrt.exe을 실행 시키면 아래 그림과 같이 실행이 되죠~ 같이 생성되는 sqrt.exe 실행 파일이 실행되기 위해서는 python27.dll 파일이 환경변수 안에 있으면 됩니다.


apsw, aspell-python, assimulo, astropy, Atom, autopy, Babel, backports, basemap, Bazaar, bcolz, bigfloat, bioformats, biopython, bio_formats, bitarray, BLAZE, blender-mathutils, blist, blosc, bokeh, boost.python, bottleneck, bsdiff4, carray, cartopy, casuarius, cdecimal, cellcognition, cellprofiler, ceodbc, certifi, cffi, cgal-python, cgkit, Cheetah, cld, conda, Console, Coverage, curses, cvxopt, cx_freeze, cython, cytoolz, delny, dipy, docutils, dpmix, dynd, EcOS, enaml, epydoc, ETS, fastcluster, faulthandler, ffnet, fiona, fipy, fonttools, friture, gdal, gevent, gmpy, greenlet, guiqwt, h5py, holopy, htseq, ilastik, iminuit, imread, intbitset, iocbio, IPython, iris, javabridge, jcc, jinja2, jpype, jsonlib, kivy, kiwisolver, kwant, la, liblas, liblinear, libpython, libsbml, libsvm, libtfr, libxml-python, line_profiler, llist, llvmlite, llvmpy, lp_solve, lsqfit, lxml, mahotas, MAKO, marisa-trie, markupsafe, matplotlib, MDP, Mercurial, meshpy, milk, minepy, mlpy, mmlib, mmseg, mmtk, mod_wsgi, mpi4py, msgpack, mxbase, mysql-python, mysqlclient, natgrid, netcdf4, networkx, nibabel, nipy, nipype, nitime, nlopt, nltk, nmoldyn, Noise, nose, numba, Numeric, numexpr, numpy, numscons, ODE, openbabel, opencv, openexr, openglcontext, openimageio, ORANGE, oursql, pandas, patsy, pgmagick, pillow, pip, Planar, Polygon, polymode, psutil, psycopg, Pulp, py-fcm, py-postgresql, py2exe, pyalembic, pyamf, pyamg, pyaudio, pybluez, pybox2d, pycairo, pycares, pycifrw, pycluster, pycogent, pycosat, pycparser, pycuda, pycurl, pydbg, pydde, pyeda, pyephem, pyexiv2, pyfftw, pyfftw3, pyfits, pyfltk, pyfmi, pygame, pygit2, pyglet, pygments, pygraphviz, pygtk, pyhdf, pyhook, pyicu, pyisapie, pylibdeconv, pylibtiff, pylzma, pymatlab, pymc, pymca, pymedia, pymex, pyminuit, pymix, pymol, pymongo, pymssql, pymunk, pymutt, pymvpa, pynifti, pyodbc, pyopencl, pyopengl, pyparsing, pyproj, pyqt4, pyqwt, pyreadline, pyropes, pyrxp, pySerial, pysfml, pyshp, pyside, pysparse, pyspharm, pysqlite, pystemmer, pytables, python-cjson, python-dateutil, python-igraph, python-ldap, python-levenshtein, python-lz4, python-lzo, python-snappy, python-sundials, pythonmagick, pythonnet, pytst, pytz, pyusb-ftdi, pyviennacl, pyvisa, pyvrml97, pywavelets, pywcs, pywin32, pyxml, pyyaml, pyzmq, qimage2ndarray, quantlib, quickfix, qutip, rasterio, re2, Regex, reportlab, requests, rpy2, rtmidi-python, rtree, scientificpython, scikit-bio, scikit-image, scikit-learn, scikits.ann, scikits.audiolab, scikits.delaunay, scikits.hydroclimpy, scikits.odes, scikits.samplerate, scikits.scattpy, scikits.timeseries, scikits.umfpack, scikits.vectorplot, scipy, scipy-cluster, scipy-stack, scitools, scons, sendkeys, setuptools, sfepy, shapely, silvercity, simpleitk, simplejson, Six, slycot, smc.freeimage, sparsesvd, sphinx, Spyder, SQLAlchemy, statsmodels, steps, sympy, ta-lib, theano, thrift, tinyarray, Tornado, trfit, twainmodule, Twisted, ujson, umysql, veusz, videocapture, vigra, virtualenv, visionegg, vispy, visvis, vitables, vlfd, vpython, vtk, wxPython, yappi, YT, zodb3, zope.interface

요즘 파이썬을 주로 사용하면서 다양한 모듈들을 찾는 재미에 푹 빠졌는데요~

 

윈도우를 주로 사용하다 보니 pip 로 인스톨이 안되는 경우가 종종 있더군요.

 

이런 경우에는 버츄얼 박스에서 리눅스를 설치해서 사용해도 되긴 하는데~

 

찾아보니 아래 주소에 다양한 윈도우용 파이썬 모듈들이 있더군요.

 

http://www.lfd.uci.edu/~gohlke/pythonlibs/

 

위 주소에서 제공하는 모듈들은 다음과 같습니다.

 

pycosat, virtualenv, pip, setuptools, requests, libsvm, liblinear, cytoolz, dynd, gevent, bokeh, blaze, pygit2, numba, llvmlite, iris, pillow, mercurial, netcdf4, rpy2, biopython, reportlab, scipy, yt, nibabel, backports, pandas, ets, pyalembic, shapely, scikit-bio, pycairo, spyder, statsmodels, python-dateutil, pytz, sfepy, apsw, python-igraph, pyqwt, pylzma, openimageio, pymssql, pyvisa, sympy, lxml, lsqfit, thrift, pyicu, pyside, guiqwt, pyqt4, regex, gdal, cellcognition, vigra, h5py, pytables, pycurl, ipython, pygments, mahotas, pyspharm, imread, scons, kiwisolver, enaml, atom, faulthandler, conda, bigfloat, yappi, visvis, simplejson, line_profiler, rasterio, fiona, bioformats, javabridge, mysqlclient, numpy, pyzmq, pyfftw, minepy, mlpy, matplotlib, py2exe, veusz, greenlet, cython, sqlalchemy, bcolz, psutil, vlfd, pyparsing, pymc, pywin32, friture, pymol, orange, python-ldap, gmpy, pymca, blender-mathutils, jcc, scientificpython, opencv, kwant, pymunk, pulp, jpype, intbitset, astropy, qutip, networkx, twisted, pylibtiff, quickfix, six, nltk, tornado, numexpr, rtree, polygon, pythonnet, pycares, scikit-learn, psycopg, sphinx, vispy, scipy-stack, nose, libpython, pyxml, cvxopt, pycuda, basemap, qimage2ndarray, iminuit, pgmagick, milk, llvmpy, pymongo, nlopt, libsbml, pysqlite, pyfits, patsy, certifi, mxbase, python-lz4, blosc, meshpy, docutils, cffi, scikit-image, lp_solve, pyeda, pystemmer, pyopengl, pyrxp, pymvpa, cartopy, natgrid, python-levenshtein, ecos, msgpack, pyfmi, assimulo, nitime, mako, jinja2, pyephem, pyopencl, mod_wsgi, cx_freeze, pyviennacl, markupsafe, vitables, mpi4py, quantlib, pyaudio, steps, mmtk, pyminuit, smc.freeimage, vtk, pyhdf, pyyaml, pycifrw, pygame, videocapture, pythonmagick, pyvrml97, openglcontext, zope.interface, blist, aspell-python, ode, pycluster, cdecimal, noise, scikits.odes, scikits.umfpack, scikits.ann, scikits.vectorplot, curses, mysql-python, oursql, libtfr, htseq, marisa-trie, ffnet, polymode, slycot, ta-lib, pymutt, bsdiff4, pyfltk, pyisapie, pycparser, pybluez, openbabel, pysfml, pywavelets, pyserial, ujson, rtmidi-python, kivy, nipype, pydde, llist, pymix, dipy, bio_formats, bottleneck, fastcluster, la, cgkit, planar, ceodbc, scipy-cluster, pyhook, pyproj, sparsesvd, simpleitk, casuarius, coverage, twainmodule, python-snappy, theano, boost.python, bitarray, pyodbc, fonttools, pylibdeconv, fipy, tinyarray, pyshp, carray, pysparse, nipy, bazaar, pygraphviz, babel, pyamg, umysql, scikits.samplerate, scikits.scattpy, scikits.hydroclimpy, scikits.delaunay, autopy, libxml-python, pyusb-ftdi, mmlib, cellprofiler, pyreadline, py-fcm, liblas, vpython, scikits.audiolab, py-postgresql, pyamf, holopy, pyropes, epydoc, cheetah, pywcs, python-sundials, openexr, dpmix, cld, mdp, pycogent, jsonlib, silvercity, console, python-cjson, pytst, sendkeys, pydbg, pyglet, python-lzo, delny, pyexiv2, ilastik, scitools, trfit, re2, cgal-python, pymedia, pyfftw3, pymex, pymatlab, zodb3, pygtk, numeric, nmoldyn, iocbio, wxpython, pybox2d, mmseg, pynifti, scikits.timeseries, numscons, visionegg

+ Recent posts