การนำเข้า Ghostscript บน Windows 10

Jan 06 2021

ฉันพยายามนำเข้าghostscriptสู่ Python

เมื่อฉันพิมพ์import ghostscriptฉันได้รับข้อความแสดงข้อผิดพลาดต่อไปนี้:

Traceback (การโทรล่าสุดล่าสุด): ไฟล์ "<pyshell # 0>" บรรทัดที่ 1 ในการนำเข้าไฟล์ ghostscript "C: \ Users ... \ AppData \ Local \ Programs \ Python \ Python38-32 \ lib \ site-Packages \ ghostscript_ init _.py ", บรรทัดที่ 35, เข้าจาก. นำเข้า _gsprint เป็นไฟล์ gs "C: \ Users ... \ AppData \ Local \ Programs \ Python \ Python38-32 \ lib \ site-package \ ghostscript_gsprint.py" บรรทัด 505 ในการเพิ่ม RuntimeError ('ไม่พบ Ghostscript DLL ในรีจิสทรี ') RuntimeError: ไม่พบ Ghostscript DLL ในรีจิสทรี

ฉันใช้ Windows 10

ฉันยืนยันว่าฉันใช้ Python 3.8.3, 32-bit

ฉันพบหัวข้อนี้: การนำเข้า Ghostscript ใน Python บน Windows 8แต่ไม่ค่อยมีประโยชน์

ข้อเสนอแนะใด ๆ ?

ฉันไม่แน่ใจว่าจะทราบได้อย่างไรว่าฉันใช้ ghostscript เวอร์ชัน 32 บิตหรือ 64 บิต

แก้ไข # 1:

ฉันติดตั้ง Ghostscript โดยทำ python -m pip install ghostscript

คำตอบ

1 JaapJorisVens Jan 06 2021 at 05:42

ตามเอกสารที่ghostscriptแพคเกจ PyPi ต้องมีการติดตั้งที่มีอยู่ของ Ghostscript:

python-ghostscript ต้องการ

  • Python 2.7 หรือสูงกว่า (ทดสอบกับ Python 2.7, 3.4, 3.6 และ 3.6)
  • setuptools สำหรับการติดตั้ง (ดูด้านล่าง)
  • Ghostscript เวอร์ชัน 8.x หรือสูงกว่า (ทดสอบด้วย 9.x)

คุณสามารถดาวน์โหลดGhostscript สำหรับ Windows ที่นี่