简体   繁体   English

附加到LD_LIBRARY_PATH会中断python

[英]Appending to LD_LIBRARY_PATH breaks python

I have recently been doing some Maya Plugin-in development, and in order to link against their API's added this to my ~/.bashrc : LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/autodesk/maya/lib This worked well and now all of the shared libraries are reported as found when running ldd. 我最近一直在做一些Maya插件开发,为了链接他们的API,将其添加到我的~/.bashrcLD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/autodesk/maya/lib这一切正常,现在所有运行ldd时发现共享库被报告为已找到。

However a side effect of this is that I know receive an error when running python from the shell: 但是,这样做的副作用是,我知道从外壳运行python时会收到错误消息:

$> python
Could not find platform independent libraries <prefix>
Could not find platform dependent libraries <exec_prefix>
Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]
ImportError: No module named site

I presume this is due to the python2.7 that is packaged with maya and found at /usr/autodesk/maya/lib , there are no issues when running python3. 我认为这是由于与Maya打包并在/usr/autodesk/maya/lib找到的python2.7所致,运行python3时没有问题。 Is there a way for me to fix this without having to conditionally add and remove from my LD_LIBRARY_PATH ? 我有办法解决此问题而不必有条件地从LD_LIBRARY_PATH添加和删​​除吗?

尝试这个:

LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/autodesk/maya/lib/python2.7/site-packages:/usr/autodesk/maya/lib

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM