Notice
Recent Posts
Recent Comments
Link
«   2025/05   »
1 2 3
4 5 6 7 8 9 10
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25 26 27 28 29 30 31
Tags
more
Archives
Today
Total
관리 메뉴

main

[PyInstaller] ImportError: cannot import name 'MarkdownExporter' from 'nbconvert' 본문

Python

[PyInstaller] ImportError: cannot import name 'MarkdownExporter' from 'nbconvert'

1984 2023. 6. 22. 23:32

에러

"dataframe_image" 패키지를 사용하는 프로젝트를 PyInstaller 로 빌드하여, exe 파일을 실행시키면 "nbconvert" 모듈의 Import Error 발생

ImportError: cannot import name 'MarkdownExporter' from 'nbconvert'

해결 방법

1. nbconvert를 6.4.3 버전으로 다운그레이드

pip install nbconvert==6.4.3

2. dataframe_image 디렉토리를 찾을 수 없다는 에러 발생

FileNotFoundError: [Errno 2] No such file or directory: 'D:\\code\\python\\...\\dist\\...\\dataframe_image\\static\\style.css'

3. .spec 파일의 datas에 dataframe_image 폴더 추가

.spec 파일은 pyinstaller를 한번 실행시키면 생성됨.

.conda 및 가상환경 폴더 경로 확인하여 설정해준다.

datas=[(r"C:\path\.conda\envs\env\Lib\site-packages\dataframe_image\static\style.css", r"dataframe_image\static")],

4. 수정한 .spec 파일로 pyinstaller 재실행

pyinstaller example.py

 

참고자료

- 비슷한 에러

https://github.com/orgs/pyinstaller/discussions/6432

 

728x90
Comments