在我的OSX 10.9.2上,我安装了Maya 2014学生版,它随Python 2.7.3一起提供。问题是,现在每当我在bash中运行python
时,Maya的Python解释器总是会启动,它位于:
/Applications/Autodesk/maya2014/Maya.app/Contents/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python
我已使用python
和which
验证了ls -l
确切指出的内容:
$ which python
/Library/Frameworks/Python.framework/Versions/2.7/bin/python
$ ls -l /Library/Frameworks/Python.framework/Versions/2.7/bin/python
lrwxr-xr-x 1 root admin 7 May 24 12:21 /Library/Frameworks/Python.framework/Versions/2.7/bin/python -> python2
$ ls -l /Library/Frameworks/Python.framework/Versions/2.7/bin/python2
lrwxr-xr-x 1 root admin 9 May 24 12:21 /Library/Frameworks/Python.framework/Versions/2.7/bin/python2 -> python2.7
$ ls -l /Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7
-rwxrwxr-x 1 root admin 25624 Nov 10 2013 /Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7
这意味着python
最终指向python2.7
,后者是可执行文件而不是链接。但是,当我运行python
并使用Ctrl
+ Z
暂停解释程序并使用ps
列出流程时,我看到了:
67937 ttys001 0:00.03 /Applications/Autodesk/maya2014/Maya.app/Contents/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python
关于如何发生这种情况的任何想法?非常感谢。
答案 0 :(得分:0)
事实证明,.profile
中的以下行覆盖了预期的python
可执行路径:
MAYA_LOCATION=/Applications/Autodesk/maya2014/Maya.app/Contents
export MAYA_LOCATION
DYLD_FRAMEWORK_PATH=$DYLD_FRAMEWORK_PATH:$MAYA_LOCATION/Frameworks
export DYLD_FRAMEWORK_PATH
在对这些内容进行评论后,我设法/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python
正在运行。
根据Mac Developer Library(https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man1/dyld.1.html),DYLD_FRAMEWORK_PATH
会覆盖将在其中搜索框架的目录。但奇怪的是,即使/usr/local/bin/python
指向/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python
,DYLD_FRAMEWORK_PATH
仍然可以覆盖它。
实际已解决,但仍不知道DYLD_FRAMEWORK_PATH
如何影响/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python
。