Hata: Python'da IronPDF Bulunamadı

This article was translated from English: Does it need improvement?
Translated
View the article in English

.NET 6.0 SDK'nı ve IronPdf'i aşağıdaki komutla pip kullanarak yüklediğiniz varsayıldığında:

pip install ironpdf

Python betiğini çalıştırdığınızda aşağıdaki istisnayla karşılaşabilirsiniz:

Exception has occurred: Exception
Failed to locate IronPdf.Slim.dll at 'C:\Users\Name\AppData\Local\Programs\Python\Python311/IronPdf.Slim'. Please see /troubleshooting/quick-ironpdf-troubleshooting/ for more information
  File "C:\Users\Name\OneDrive\Documents\IronPdfPythonNew\working\viewport.py", line 1, in <module>
    from ironpdf import *
Exception: Failed to locate IronPdf.Slim.dll at 'C:\Users\Name\AppData\Local\Programs\Python\Python311/IronPdf.Slim'. Please see https://ironpdf.com/troubleshooting/quick-ironpdf-troubleshooting/ for more information

Çözüm

Konumun IronPdf.Slim oldugu dizin asagidaki gibi belirtilebilir:

import sys
# Set the path to include the directory containing the IronPdf.Slim files.
# Users can determine this location by running `pip uninstall ironpdf` and pressing `N` to view the installation path.
sys.path.append('/path/to/python/packages')
import sys
# Set the path to include the directory containing the IronPdf.Slim files.
# Users can determine this location by running `pip uninstall ironpdf` and pressing `N` to view the installation path.
sys.path.append('/path/to/python/packages')
PYTHON

Örneğin

import sys
# Add the directory of the IronPdf installation to the path for module resolution.
# This should point to the root directory of where IronPdf is installed.
sys.path.append(r'C:\Users\lyty1\AppData\Local\Programs\Python\Python311\Lib\site-packages')

from ironpdf import *

# Instantiate Renderer
renderer = ChromePdfRenderer()

# Create a PDF from a URL or local file path
pdf = renderer.RenderUrlAsPdf("https://ironpdf.com/")

# Export to a file or Stream
pdf.SaveAs("url.pdf")
import sys
# Add the directory of the IronPdf installation to the path for module resolution.
# This should point to the root directory of where IronPdf is installed.
sys.path.append(r'C:\Users\lyty1\AppData\Local\Programs\Python\Python311\Lib\site-packages')

from ironpdf import *

# Instantiate Renderer
renderer = ChromePdfRenderer()

# Create a PDF from a URL or local file path
pdf = renderer.RenderUrlAsPdf("https://ironpdf.com/")

# Export to a file or Stream
pdf.SaveAs("url.pdf")
PYTHON

Neden

Çoğu üçüncü taraf kütüphane, Python kurulum dizininde veya sanal ortam kullanıyorsanız sanal ortam dizini içinde 'site-packages' adlı bir dizinde yüklenir. Bu, Python yorumlayıcınız tarafından erişilebilen dizindir.

IronPDF hem IronPdf.Slim hem de IronPdf.Native.Chrome.Windows kuracaktir.

Tam konum, işletim sistemine ve Python yapılandırmanıza bağlı olarak değişebilir.

Curtis Chau
Teknik Yazar

Curtis Chau, Bilgisayar Bilimleri alanında lisans derecesine sahiptir (Carleton Üniversitesi) ve Node.js, TypeScript, JavaScript ve React konularında uzmanlaşmış ön uç geliştirme üzerine uzmanlaşmıştır. Kullanıcı dostu ve estetik açıdan hoş arayüzler tasarlamaya tutkuyla bağlı olan Curtis, modern çerç...

Daha Fazlasını Oku
Başlamaya Hazır mısınız?
Sürüm: 2026.4 yeni yayınlandı
Still Scrolling Icon

Hala Kaydiriyor musunuz?

Hızlı bir kanit mi istiyorsunuz?
bir örnek çalıştır HTML'nizin PDF olduğunu izleyin.