Sometimes you may find it necessary or convenient to install multiple different versions of PyXLL into Excel at the same time. For example, if you have some code that requires Python 3 and some other code that requires Python 2.
You cannot install two add-in files with the same filename, however it is possible to install two versions of PyXLL be renaming one of them. When renaming the pyxll.xll file you also need to rename the pyxll.cfg file. For example, if you wanted to install a Python 2 build of PyXLL and a Python 3 build of PyXLL you would rename the relevant PyXLL files as follows:
pyxll-py38-x64/pyxll.xll --> pyxll-py38.xll
pyxll-py38-x64/pyxll.cfg --> pyxll-py38.cfg
pyxll-py27-x64/pyxll.xll --> pyxll-py27.xll
pyxll-py27-x64/pyxll.cfg --> pyxll-py27.cfg
As well as renaming the PyXLL files you will also need to update the PyXLL config files. Each config file will need to be set to reference the relevant Python environment, but also you will want to change the "name" setting so that they don't appear to Excel to be the same add-ins.
Finally, PyXLL uses a couple of COM components for its ribbon control and for RTD functions. These are registration free internal components so usually you don't have to worry about them, but when installing multiple versions of PyXLL side by side you will need to change the identifiers for these COM components. The identifiers are GUIDs and you can use an online service like https://guidgenerator.com/ to create new ids to use.
The changes to your final config will end up looking something like this:
[PYXLL]
name = PyXLL_Python_2
com_clsid = {f0b981ec-1bd7-4a0e-94d8-46e98b0cc637}
rtd_clsid = {f84f03ea-c146-4762-ac16-6062302d071b}
[PYTHON]
executable = C:\Users\Python27\pythonw.exe
Once you have configured both versions of PyXLL you will be able to install them side by side in Excel.
Note that when using different versions of Python then two separate Python runtimes will be loaded and objects from one Python runtime will not be available to the other. It is possible that not all 3rd party packages will be able to have different versions be loaded into the same process at the same time, so some testing may be required to ensure that everything works correctly.