PyXLL The Python Excel Add-In
  • Product
    • Features
    • Get Started
    • Request Demo
    • Download
  • Pricing
  • Resources
    • Documentation
    • Blog
    • Videos
    • FAQ
    • Learn Python
    • Customer Portal
    • About Us
  • Support
    • Documentation
    • Videos
    • FAQ
    • Contact Us
  • Contact Us
Table of Contents
  • PyXLL Documentation
  • Introduction to PyXLL
  • User Guide
    • Installing PyXLL
    • Configuring PyXLL
      • Python Settings
      • PyXLL Settings
      • License Key
      • Logging
      • Warnings
      • Configuration Variables
      • Environment Variables
      • Startup Script
      • Menu Ordering
      • Shortcuts
      • Default Decorator Parameters
    • Worksheet Functions
    • Macro Functions
    • Real Time Data
    • Cell Formatting
    • Charts and Plotting
    • Custom Task Panes
    • ActiveX Controls
    • Using Pandas in Excel
    • Customizing the Ribbon
    • Context Menu Functions
    • Working with Tables
    • Python as a VBA Replacement
    • Menu Functions
    • Reloading and Rebinding
    • Error Handling
    • Deploying your add-in
    • Workbook Metadata
  • Video Guides and Tutorials
  • API Reference
  • What’s new in PyXLL 5
  • Changelog
Close

Python Settings¶

[PYTHON]
;
; Python settings
;
pythonpath = semi-colon or new line delimited list of directories
executable = full path to the Python executable (python.exe)
dll = full path to the Python dynamic link library (pythonXX.dll)
pythonhome = location of the standard Python libraries
ignore_environment = ignore environment variables when initializing Python
inspect = see sys.flags.inspect (default is 1)
optimize = see sys.flags.optimize (default is 0)
debug = see sys.flags.debug (default is 0)
verbose = see sys.flags.verbose (default is 0)
dont_write_bytecode = see sys.flags.dont_write_bytecode (default is 0)
no_user_site = see sys.flags.no_user_site (default is 0)
no_site = see sys.flags.no_site (default is 0)

The Python settings determine which Python interpreter will be used, and some Python settings. Generally speaking, when your system responds to the python command by running the correct interpreter there is usally no need to alter this part of your configuration.

Sometimes you may want to specify options that differ from your system default; for example, when using a Python virtual environment or if the Python you want to use is not installed as your system default Python.

  • pythonpath

    The pythonpath is a list of directories that Python will search in when importing modules.

    When writing your own code to be used with PyXLL you will need to change this to include the directories where that code can be imported from.

    [PYTHON]
    pythonpath =
        c:\path\to\your\code
        c:\path\to\some\more\of\your\code
        .\relative\path\relative\to\config\file
    
  • executable

    If you want to use a different version of Python than your system default Python then setting this option will allow you to do that.

    Note that the Python version (e.g. 2.7 or 3.5) must still match whichever Python version you selected when downloading PyXLL, but this allows you to switch between different virtual environments or different Python distributions.

    PyXLL does not actually use the executable for anything, but this setting tells PyXLL where it can expect to find the other files it needs as they will be installed relative to this file (e.g. the Python dll and standard libraries).

    [PYTHON]
    executable = c:\path\to\your\python\installation\pythonw.exe
    

    If you wish to set the executable globally outside of the config file, the environment variable PYXLL_PYTHON_EXECUTABLE can be used. The value set in the config file is used in preference over this environment variable.

  • dll

    PyXLL can usually locate the necessary Python dll without further help, but if your installation is non-standard or you wish to use a specific dll for any reason then you can use this setting to indform PyXLL of its location..

    [PYTHON]
    dll = c:\path\to\your\python\installation\pythonXX.dll
    

    If you wish to set the dll globally outside of the config file, the environment variable PYXLL_PYTHON_DLL can be used. The value set in the config file is used in preference over this environment variable.

  • pythonhome

    The location of the standard libraries is usually determined by the location of the Python executable.

    If for any reason the standard libraries are not installed relative to the chosen or default executable then setting this option will tell PyXLL where to find them.

    Usually if this setting is set at all it should be set to whatever sys.prefix evaluates to in a Python prompt from the relevant interpreter.

    [PYTHON]
    pythonhome = c:\path\to\your\python\installation
    

    If you wish to set the pythonhome globally outside of the config file, the environment variable PYXLL_PYTHONHOME can be used. The value set in the config file is used in preference over this environment variable.

  • ignore_environment

    New in PyXLL 3.5

    When this option is set to any value, any standard Python environment variables such as PYTHONPATH are ignored when initializing Python.

    This is advisable so that any global environment variables that might conflict with the settings in the pyll.cfg file do not affect how Python is initialized.

    This must be set if using FINCAD, as FINCAD sets PYTHONPATH to it’s own internal Python distribution.

  • inspect

    New in PyXLL 4.5

    This should typically left unset, and has a default value of 1.

    Setting to 1 is equivalent to starting Python with the “-i” switch.

    If not set, raising a SystemExit exception will cause the Excel process to exit.

    See sys.flags.inspect in the Python documentation for more information.

  • optimize

    New in PyXLL 4.5

    Setting to 1 is equivalent to starting Python with the “-O” switch.

    This should typically left unset, and has a default value of 0.

    See sys.flags.optimize in the Python documentation for more information.

  • debug

    New in PyXLL 4.5

    Setting to 1 is equivalent to starting Python with the “-d” switch.

    This should typically left unset, and has a default value of 0.

    See sys.flags.debug in the Python documentation for more information.

  • verbose

    New in PyXLL 4.5

    Setting to 1 is equivalent to starting Python with the “-v” switch.

    This should typically left unset, and has a default value of 0.

    See sys.flags.verbose in the Python documentation for more information.

  • dont_write_bytecode

    New in PyXLL 4.5

    Setting to 1 is equivalent to starting Python with the “-B” switch.

    This should typically left unset, and has a default value of 0.

    See sys.flags.dont_write_bytecode in the Python documentation for more information.

  • no_user_site

    New in PyXLL 4.5

    Setting to 1 is equivalent to starting Python with the “-s” switch.

    This can be set if you do not want Python to import user installed site packages.

    See sys.flags.no_user_site in the Python documentation for more information.

  • no_site

    New in PyXLL 4.5

    Setting to 1 is equivalent to starting Python with the “-S” switch.

    This should typically left unset, and has a default value of 0.

    See sys.flags.no_site in the Python documentation for more information.

« Configuring PyXLL
PyXLL Settings »
  • Home
  • Product
  • Features
  • Documentation
  • Download
  • Pricing
  • Support
  • Documentation
  • Videos
  • FAQ
  • Learn Python
  • Contact Us
  • About
  • About Us
  • Legal
  • Blog
© Copyright PyXLL Ltd