파이썬 스크립트 용 실행 파일을 만들기 위해 PyInstaller를 설치했는데 제대로 작동합니다. 필자는 PyPandoc을 사용하여 .docx
보고서를 만들었습니다. 일반 Python 파일이 실행될 때 정상적으로 실행되지만 PyInstaller 실행 파일에서는 실행되지 않습니다.PyPandoc with PyInstaller
Traceback (most recent call last):
File "src\flexmodel_postcalc.py", line 295, in postcalculate_everything
File "src\flexmodel_postcalc.py", line 281, in generate_report_docx
File "src\flexmodel_report_docx.py", line 118, in generate_text_useages_docx
File "pypandoc\__init__.py", line 50, in convert
File "pypandoc\__init__.py", line 70, in _convert
File "pypandoc\__init__.py", line 197, in get_pandoc_formats
File "pypandoc\__init__.py", line 336, in _ensure_pandoc_path
OSError: No pandoc was found: either install pandoc and add it
to your PATH or install pypandoc wheels with included pandoc.
실행 파일을 만드는 동안 PyPandoc에 관한 이상한 문제는 없습니다. Python 및/또는 Pandoc 설치가없는 다른 사람들이 실행 파일을 사용하고 .docx
보고서를 만들 수 있도록 Pandoc을 실행 파일에 포함하려면 어떻게해야합니까?
편집 : pythonfile.py
실행 파일을 만들 때
import pypandoc
pypandoc.convert(source='# Sample title\nPlaceholder', to='docx', format='md', outputfile='test.docx')
이 파일을 저장 :
다음 코드를 포함한 파일을 만듭니다 작업 프로세스는 다음 단계를 포함 PyInstaller :
pyinstaller --onefile --clean pythonfile.py
이제 실행 파일은 Pandoc (또는 PyPandoc)이 설치되어 있지 않은 컴퓨터에서 실행해야합니다.
파이썬 스크립트의 최소 작동 예제를 추가하여 사용중인 pandoc의 부분을 확인할 수 있습니까? 나는'pypandoc' 만 시도해 봤고 내 Windows 시스템에서 정상적으로 작동하는 것 같습니다. 대부분 'pypandoc'을 [숨겨진 가져 오기] (https://pythonhosted.org/PyInstaller/when-things-go-wrong.html#listing-hidden-imports)와 다른 의존성에 추가해야합니다. – Repiklis
@Repiklis 아주 짧은 샘플 코드를 제공 할 수는 있지만 지금은 테스트하지 마십시오. 'import pypandoc; pypandoc.convert (source = '# 샘플 제목 \ nPlaceholder', to = 'docx', format = 'md', outputfile = 'test.docx')'. 이것은'.py' 파일에 저장됩니다.이 파일은'pyinstaller --onefile --clean -p H : \ AppData \ Python \ Python27 \ Lib \ site-packages pythonfile.py' 명령으로 변환합니다. – Mathias711
게시하십시오 다른 사용자가 귀하의 문제를 이해할 수 있도록 질문의 샘플 코드. 아래에 답변을 게시하겠습니다. – Repiklis