-
pyinstaller error (matplot lib 버전 문제)SW개발/Python 2020. 12. 3. 21:55
pyinstaller --onefile main.py로 실행파일을 생성할 때 다음과 같은 에러 메세지가 나왔다.
37342 INFO: Matplotlib backend "nbAgg": ignored No module named 'IPython' 39665 INFO: Matplotlib backend "Qt4Agg": ignored Failed to import any qt binding 41817 INFO: Matplotlib backend "Qt4Cairo": ignored cairo backend requires that pycairo>=1.11.0 or cairocffiis installed 44254 INFO: Matplotlib backend "Qt5Agg": ignored Failed to import any qt binding 46167 INFO: Matplotlib backend "Qt5Cairo": ignored cairo backend requires that pycairo>=1.11.0 or cairocffiis installed 48541 INFO: Matplotlib backend "TkAgg": added 50920 INFO: Matplotlib backend "TkCairo": ignored cairo backend requires that pycairo>=1.11.0 or cairocffiis installed 52921 INFO: Matplotlib backend "WebAgg": ignored Traceback (most recent call last): File "c:\users\boyoun.park\appdata\local\programs\python\python37\lib\site-packages\matplotlib\backends\backend_webagg.py", line 27, in <module> import tornado ModuleNotFoundError: No module named 'tornado' The above exception was the direct cause of the following exception: Traceback (most recent call last): File "<string>", line 12, in <module> File "c:\users\boyoun.park\appdata\local\programs\python\python37\lib\site-packages\matplotlib\backends\backend_webagg.py", line 29, in <module> raise RuntimeError("The WebAgg backend requires Tornado.") from err RuntimeError: The WebAgg backend requires Tornado. 55134 INFO: Matplotlib backend "WX": ignored No module named 'wx' 68366 INFO: Matplotlib backend "WXAgg": ignored No module named 'wx' 70517 INFO: Matplotlib backend "WXCairo": ignored No module named 'wx' 72713 INFO: Matplotlib backend "agg": added 76114 INFO: Matplotlib backend "cairo": ignored cairo backend requires that pycairo>=1.11.0 or cairocffiis installed 78538 INFO: Matplotlib backend "pdf": added 80957 INFO: Matplotlib backend "pgf": added 83174 INFO: Matplotlib backend "ps": added 85419 INFO: Matplotlib backend "svg": added 87853 INFO: Matplotlib backend "template": added 87988 INFO: Loading module hook 'hook-matplotlib.py' from 'c:\\users\\boyoun.park\\appdata\\local\\programs\\python\\python37\\lib\\site-packages\\PyInstaller\\hooks'... 89825 INFO: Loading module hook 'hook-numpy.core.py' from 'c:\\users\\boyoun.park\\appdata\\local\\programs\\python\\python37\\lib\\site-packages\\PyInstaller\\hooks'... 90041 INFO: Loading module hook 'hook-numpy.py' from 'c:\\users\\boyoun.park\\appdata\\local\\programs\\python\\python37\\lib\\site-packages\\PyInstaller\\hooks'... 90043 INFO: Loading module hook 'hook-pandas.py' from 'c:\\users\\boyoun.park\\appdata\\local\\programs\\python\\python37\\lib\\site-packages\\PyInstaller\\hooks'... 92862 INFO: Loading module hook 'hook-PIL.Image.py' from 'c:\\users\\boyoun.park\\appdata\\local\\programs\\python\\python37\\lib\\site-packages\\PyInstaller\\hooks'... 788868 INFO: Loading module hook 'hook-PIL.py' from 'c:\\users\\boyoun.park\\appdata\\local\\programs\\python\\python37\\lib\\site-packages\\PyInstaller\\hooks'... 788870 INFO: Import to be excluded not found: 'PySide' 788870 INFO: Import to be excluded not found: 'FixTk' 788870 INFO: Excluding import 'PyQt5' 788872 INFO: Removing import of PyQt5 from module PIL.ImageQt 788872 INFO: Excluding import 'tkinter' 788874 INFO: Removing import of tkinter from module PIL.ImageTk 788874 INFO: Excluding import 'PyQt4' 788876 INFO: Loading module hook 'hook-PIL.SpiderImagePlugin.py' from 'c:\\users\\boyoun.park\\appdata\\local\\programs\\python\\python37\\lib\\site-packages\\PyInstaller\\hooks'... 788878 INFO: Excluding import 'tkinter' 788879 INFO: Import to be excluded not found: 'FixTk' 788879 INFO: Loading module hook 'hook-pkg_resources.py' from 'c:\\users\\boyoun.park\\appdata\\local\\programs\\python\\python37\\lib\\site-packages\\PyInstaller\\hooks'... 791524 INFO: Processing pre-safe import module hook win32com from 'c:\\users\\boyoun.park\\appdata\\local\\programs\\python\\python37\\lib\\site-packages\\_pyinstaller_hooks_contrib\\hooks\\pre_safe_import_module\\hook-win32com.py'. Traceback (most recent call last): File "<string>", line 2, in <module> ModuleNotFoundError: No module named 'win32com' 792819 INFO: Processing pre-safe import module hook win32com from 'c:\\users\\boyoun.park\\appdata\\local\\programs\\python\\python37\\lib\\site-packages\\_pyinstaller_hooks_contrib\\hooks\\pre_safe_import_module\\hook-win32com.py'. Traceback (most recent call last): File "<string>", line 2, in <module> ModuleNotFoundError: No module named 'win32com' 794026 WARNING: Hidden import "pkg_resources.py2_warn" not found! 794026 WARNING: Hidden import "pkg_resources.markers" not found! 794027 INFO: Excluding import '__main__' 794030 INFO: Removing import of __main__ from module pkg_resources
빌드는 끝까지 됐지만 생성된 dist/main.exe 는 결국 다음과 같은 matplotlib 관련 에러를 뱉고 실행되지 않았다.
MatplotlibDeprecationWarning: Matplotlib installs where the data is not in the mpl-data subdirectory of the package are deprecated since 3.2 and support for them will be removed two minor releases later.
해결책을 확인한 결과, matplotlib version 문제였다. 3.0.3으로 다운그레이드시 해결된다.
(해결책 설명: stackoverflow.com/questions/57517371/matplotlibdeprecationwarning-with-pyinstaller-exe)
downgrade 명령어는 다음과 같다. cmd 창을 관리자 권한으로 열고 다음을 입력해서 다시 빌드했더니 해결되었다.
pip install 'matplotlib==3.0.3'
'SW개발 > Python' 카테고리의 다른 글
Python 숏코딩을 위한 팁 정리 (2) 2020.01.23 Python 프로파일링 (0) 2019.04.11 파이썬에서 리스트를 함수 인자로 받는 경우 - 전역 변수의 문제 (0) 2019.02.23 댓글