Last active
August 29, 2015 14:24
-
-
Save EnsekiTT/01c0d2e4b913ee16aa5f to your computer and use it in GitHub Desktop.
py2exeでmatplotlib使いたい時のsetup.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # -*- coding: utf-8 -*- | |
| ### | |
| # $ python setup.py py2exe | |
| ### | |
| from distutils.core import setup | |
| import sys | |
| import os | |
| import matplotlib | |
| import py2exe | |
| sys.argv.append('py2exe') | |
| origIsSystemDLL = py2exe.build_exe.isSystemDLL # save the orginal before we edit it | |
| def isSystemDLL(pathname): | |
| # checks if the freetype and ogg dll files are being included | |
| if os.path.basename(pathname).lower() in ("SDL_ttf.dll","freesansbold.ttf","libfreetype-6.dll", "libogg-0.dll"): | |
| return 0 | |
| return origIsSystemDLL(pathname) # return the orginal function | |
| py2exe.build_exe.isSystemDLL = isSystemDLL # override the default function with this one | |
| opts = { | |
| 'py2exe': { | |
| "bundle_files" : 3, | |
| "compressed" :1, | |
| "optimize" :2, | |
| "dll_excludes": ["MSVCP90.dll", "HID.DLL", "w9xpopen.exe"], | |
| "includes" : [ | |
| "matplotlib.backends", | |
| "matplotlib.backends.backend_tkagg" | |
| ], | |
| } | |
| } | |
| setup( | |
| data_files=matplotlib.get_py2exe_datafiles(), | |
| options=opts, | |
| console=[ | |
| {"script": "main.py"}, #__main__があるやつ | |
| #{"script": "sub.py"} #必要に応じて増やす | |
| ], | |
| zipfile=None | |
| ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment