问题
I have searched around entire internet. 1. i have 64bit 2014 maya installed, i had 32bit python installed at c:\python27.. as you know maya installs its own python and works with that, i want to change it and make maya work with my own python that is installed in c drive.
What i did? 1. i did change the python, first unisntalled and and then installed 64bit version, i copied cv2.pyd to its site-packages and also installed matplotlib,scipy, pandas, numpy. my code in pycharm works just fine but maya gives error. 2. i changed mayas python path environment but still maya is using its own installed python not pointing to mine.
import sys
print sys.platform
print sys.version
print sys.prefix
print sys.path
in maya tells me that its using python 2.7.3 whereas the python i want to point which is in c drive is 2.7.8.. anything ? how can i make maya work with the other python
回答1:
Maya's version of Python (mayapy) is compiled with Visual Studio 2010, Python's 2.7.x standard distribution is compiled with VS2008, and the two aren't compatible. So packages you install via pip in your standard 64 bit Python install won't work with Maya if they have binary dependencies. (ex numpy, scipy, PIL, pandas, etc...)
To test, open a python tab in the script editor and do this:
import sys
print (sys.version)
# Result: 2.7.3 (default, Aug 1 2012, 16:33:56) [MSC v.1600 64 bit (AMD64)] #
The part that matters here is in square brackets [MSC v.1600 64 bit (AMD64)]
.
If you do the same in your installed version of Python 2.7.x, you'll see that they won't match.
What you'll need to do is to compile these modules yourself using Visual Studio 2010 + either mayapy or a version of Python specifically built with VS2010. Either way it won't be easy in some cases.
I've made builds of packages I use compatible with Maya 2014-2015-2016 available here. Extract those packages anywhere Maya can see python packages and you should be able to work.
Side note: Maya on OSX doesn't suffer from these compatibility issues.
来源:https://stackoverflow.com/questions/34357548/changing-python-installation-for-maya