When testing code that uses the pyxll module outside of Excel you will need to install the "pyxll" module for your code to run correctly.
The PyXLL download includes a wheel file (".whl") containing a version of the pyxll module so that you can import and test your code outside of Excel.
To install the wheel open a command prompt and do the following:
- If using a virtual env, activate it
- Cd to the folder where you have extracted the PyXLL zip file
- Use "pip install" to install the Python wheel file
For example, if you were using a virtual env called "myenv", and you had extracted the PyXLL zip file to "C:\MyStuff\PyXLL", you would run the following (the exact name of the wheel file will vary depending on what version of PyXLL you have):
> activate myenvNote: If you are not using a virtual env there is no need to do the first step.
> cd C:\MyStuff\PyXLL
> pip install .\pyxll-4.3.4-cp37-win32.whl
The real pyxll module is compiled into the pyxll.xll addin, and so is always available when your code is running inside Excel.
If you are using a version of Python that doesn’t support pip you can instead simply unzip the .whl file into your Python site-packages folder (the wheel file is simply a zip file with a different file extension).