Todd Vanyo Todd Vanyo - 5 months ago 12
Python Question

python xlwings in virtualenv possible?

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?

Answer

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".