꾸준하게

[Mac] OSError: Ghostscript is not installed. 본문

이슈 해결

[Mac] OSError: Ghostscript is not installed.

yeonsikc 2024. 8. 12. 15:18

아래 코드를 실행하니 위와 같은 오류가 발생하여 brew install ghostscript 명령어로 설치를 해주었다.

하지만 설치를 했음에도 같은 오류가 발생. Stackoverflow에서 해결방법을 얻게되어 글을 작성하였다.

 

https://stackoverflow.com/questions/75391805/need-to-install-ghostscript-to-mac-path

 

실행 명령어

from llama_index.readers.pdf_table import PDFTableReader
from pathlib import Path

reader = PDFTableReader()
pdf_path = Path(file_path)
documents = reader.load_data(file=pdf_path, pages="1-3")

 

해결 방법

# Create a "lib" folder in your user directory: 
mkdir -p ~/lib

# Link Ghostscript to the "lib" folder: 
ln -s "$(brew --prefix gs)/lib/libgs.dylib" ~/lib