virtualenv has a very different usage than sitecustomize.
Basically, virtualenv can be used as a sandbox for installing python
packages, whereas sitecustomize.py is just a python script imported by the
python interpreter upon startup (
https://docs.python.org/2/library/site.html ).
One possible workflow:
- startup a new virtualenv, using mayapy as the python interpreter
(- patch the virtualenv activate script file to load the corresponding
libpython* dynamic library files (mayapy has some harcoded path coming from
autodesk build))
(-install python devel headers to be able to compile python binary modules)
- "pip install" the 3rd party packages you need
- create a sitecustomize.py containing a call to
site.addsitedir('/path/to/mayapy_virtualenv/.../site-packages')
- put this file in the maya site-packages installation dir or change the
PYTHONPATH environment variable before launching maya.bin/mayapy/mayabatch
If you set directly PYTHONPATH to
'/path/to/mayapy/virtualenv/site-packages', it won't be processed correctly
(.pth file won't be loaded)
I hope this helps, I don't quite understand what you mean by "maya-python"
so perhaps I'm missing something.
On Wednesday, December 3, 2014 12:19:43 AM UTC+1, [email protected]
wrote:
>
> Hi all,
>
> I typically use virtualenvironments for most of my python development,
> however I see that people often run into problems using virtual
> environments for maya python. I also see that people use sitecustomize.py
> (part of the site package) as an alternative to virtualenv, but I'm not
> sure i quite understand how it serves as an alternative.
>
> My ultimate goal is keep 3rd party dependencies separate for each
> maya-python project. How can I accomplish this with sitecustomize.py?
>
> Does anybody have any experience with using virtualenv with maya-python?
--
You received this message because you are subscribed to the Google Groups
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/python_inside_maya/b4825a36-c23a-4904-be44-bc9ce1b16ffe%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.