Error: Error al localizar IronPDF en Python
Asumiendo que has instalado el SDK de .NET 6.0 e IronPdf a través de pip usando el siguiente comando:
pip install ironpdf
Puede que encuentres la excepción a continuación al ejecutar el script de Python:
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 informationSolución
El directorio que contiene IronPdf.Slim puede especificarse de la siguiente manera:
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')Por ejemplo
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")Razón
La mayoría de las bibliotecas de terceros se instalan en un directorio llamado 'site-packages', que se encuentra dentro del directorio de instalación de Python o dentro del directorio del entorno virtual si estás usando entornos virtuales. Este es el directorio accesible por tu intérprete de Python.
IronPDF instalará tanto IronPdf.Slim como IronPdf.Native.Chrome.Windows.
La ubicación exacta puede variar dependiendo del sistema operativo y de tu configuración de Python.







