I've tried to start playing with xlwings using python 3.4.3 in a virtualenv, but one of the examples programs errors out because it cannot see numpy, which is very much installed in the virtualenv. pip freeze run in the virtualenv shows (cleaned some of the obviously non-essential out):
appscript==1.0.1
lxml==3.4.4
numpy==1.9.2
pandas==0.16.1
psutil==3.0.1
ptyprocess==0.5
pyparsing==2.0.3
python-dateutil==2.4.2
virtualenv==13.0.3
virtualenv-clone==0.2.5
virtualenvwrapper==4.6.0
xlrd==0.9.3
XlsxWriter==0.7.3
xlwings==0.3.5
I'm not sure that setting PYTHON_MAC to the location of my 3.4.3 install (done via Homebrew) is going to solve this because the location of the site-packages is elsewhere.
Is it possible to run xlwings from a virtualenv or do I need to have my desired packages installed in the system wide site-packages as well?
You need to set the location of PYTHON_MAC (or PYTHON_WIN) to the location of your virtualenv. E.g. PYTHON_MAC = ".../env/bin/python".
Launching Excel from an activated virtual environment (with appropriately installed packages) will provide the correct environment for xlwings.
An example for a Windows command prompt:
C:\code\xlwings>.\venv\Scripts\activate
(venv) C:\code\xlwings> "C:\Program Files\Microsoft Office\root\Office16\EXCEL.EXE"
Then open your xlwings XLSM file and run.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With