yes and no.
Python in maya on windows does respect the PYTHONPATH environment variable, so you can either set this in your user account, or for more flexible use run maya from your command line with manually installed modules.
If you’re looking for something like pip, it’s pretty simple — you can download get-pip.py from this site: https://pip.pypa.io/en/stable/installing/ , and then run it with mayapy instead of python.
Now, the somewhat bad news. Virtualenvs with Maya and windows aren’t really a possibility (at least from my experience), so anything you install with pip is going to be system-wide, and will basically require you to install it for all local machines. Because of that, I’ve found the PYTHONPATH approach much more flexible, if more of a pain (as you have to manually install pretty much everything you want, which with things like numpy/scipy is a hassle). The upside is, a lot of times you might not actually need maya, and for those types of tasks you can work as normal.
--
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 python_inside_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/dbd3a416-a7d4-4c02-8abf-ce7e1eb39542%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Based on the question, I’ve got a feeling “PYTHONPATH” and “Virtualenvs” is a little on the advanced side with regards to what Francois is looking for.
If you’re able to install anything with Python, then it’d at least be safe to assume a working knowledge of pip
, in which case this should help you get started.
Windows
$ pip install Qt.py --target ./
$ set PYTHONPATH=%cd%
$ start "" "c:\program files\autodesk\maya2018\bin\maya.exe"
Linux
$ pip install Qt.py --target ./
$ export PYTHONPATH=$(pwd)
$ maya
Where pip install Qt.py
is your everyday Python module installation procedure, followed by --target ./
which means “Install to the current working directory”. Then, set/export
makes the module known to Python, and finally Maya is launched.
From within Maya, you should then be able to say import Qt
--target
could be given any path, like a global directory of some kind where you keep all of your Maya modules, like c:\pythonpath
. Then you can set the environment variable PYTHONPATH
globally such that they are available whenever you launch Maya.
Additionally, if pip
fails with e.g. SyntaxError: invalid syntax
when you install Qt.py, then you’re using pip with Python 3 and have a little longer to travel to your end destination.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CAM33%3Da7q0ztP5ciV9r%2BvJGksrKyczpnOXOqjuF3_LgK6k%2BX7Pg%40mail.gmail.com.
import sys
sys.path.append("C:\Python27\Lib\site-packages")
import numpy
import scipy
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_maya+unsub...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/dbd3a416-a7d4-4c02-8abf-ce7e1eb39542%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
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 python_inside_maya+unsub...@googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/dbd3a416-a7d4-4c02-8abf-ce7e1eb39542%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
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 python_inside_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CAM33%3Da7q0ztP5ciV9r%2BvJGksrKyczpnOXOqjuF3_LgK6k%2BX7Pg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
--
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 python_inside_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/73598e09-169c-4a8e-aeeb-0868f6392204%40googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_maya+unsub...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/dbd3a416-a7d4-4c02-8abf-ce7e1eb39542%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
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 python_inside_maya+unsub...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CAM33%3Da7q0ztP5ciV9r%2BvJGksrKyczpnOXOqjuF3_LgK6k%2BX7Pg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
--
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 python_inside_maya+unsub...@googlegroups.com.
good call on mayapy -m ensurepip
:) I’d not seen that one before, glad to know they’ve made it a bit simpler.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/dbd3a416-a7d4-4c02-8abf-ce7e1eb39542%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
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 python_inside_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CAM33%3Da7q0ztP5ciV9r%2BvJGksrKyczpnOXOqjuF3_LgK6k%2BX7Pg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
--
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 python_inside_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/73598e09-169c-4a8e-aeeb-0868f6392204%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
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 python_inside_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/da57b011-0a89-487b-81e6-1a94de03048c%40googlegroups.com.