Skip to content

Getting started with Presidio

Simple flow

Using Presidio's modules as Python packages to get started

  1. Install Presidio

    pip install presidio-analyzer
    pip install presidio-anonymizer
    python -m spacy download en_core_web_lg
  2. Analyze + Anonymize

    from presidio_analyzer import AnalyzerEngine
    from presidio_anonymizer import AnonymizerEngine
    text="My phone number is 212-555-5555"
    # Set up the engine, loads the NLP module (spaCy model by default) 
    # and other PII recognizers
    analyzer = AnalyzerEngine()
    # Call analyzer to get results
    results = analyzer.analyze(text=text,
    # Analyzer results are passed to the AnonymizerEngine for anonymization
    anonymizer = AnonymizerEngine()
    anonymized_text = anonymizer.anonymize(text=text,analyzer_results=results)
  1. Install presidio-image-redactor

    pip install presidio-image-redactor
  2. Redact PII from image

    from presidio_image_redactor import ImageRedactorEngine
    from PIL import Image
    image =
    redactor = ImageRedactorEngine()

Read more