PYTHONPATH被其他东西覆盖

时间:2014-09-16 20:05:04

标签: python python-2.7 ubuntu-12.04

我在导入xlrd python模块时遇到问题,该模块位于/usr/lib/pymodules/python2.7/usr/local/lib/python2.7/dist-packages中。我想从/usr/local/lib/python2.7/dist-packages导入一个,但无论我做什么/usr/lib/pymodules/python2.7都停留在我的sys.path之上!

我没有成功修改我的PYTHOPATH。我的.basrc的最后一行是

export PYTHONPATH=/usr/local/lib/python2.7/dist-packages:$PYTHONPATH

所以我认为dist-packages必须位于sys.path之上!?

有人可以帮助我吗? 这是 ubunutu 12.04lts python2.7 iPython 0.12.1 当然,如果我手动编辑sys.path - 一切正常 - 我得到了正确版本的xlrd,但那个丑陋吧?我想知道将/usr/lib/pymodules...置于列表顶部的原因是什么??

这是我的sys.path:

['',  '/usr/bin',  '/usr/lib/pymodules/python2.7',  '/usr/local/lib/python2.7/dist-packages/distribute-0.7.3-py2.7.egg',  '/usr/local/lib/python2.7/dist-packages/setuptools-5.4.2-py2.7.egg',  '/usr/local/lib/python2.7/dist-packages',  '/home/venevs/Dropbox/usr/local/lib/my_packages',  '/usr/lib/python2.7',  '/usr/lib/python2.7/plat-linux2',  '/usr/lib/python2.7/lib-tk',  '/usr/lib/python2.7/lib-old',  '/usr/lib/python2.7/lib-dynload',  '/usr/lib/python2.7/dist-packages', '/usr/lib/python2.7/dist-packages/PIL',  '/usr/lib/python2.7/dist-packages/gst-0.10',  '/usr/lib/python2.7/dist-packages/gtk-2.0',  '/usr/lib/python2.7/dist-packages/ubuntu-sso-client',  '/usr/lib/python2.7/dist-packages/ubuntuone-client',  '/usr/lib/python2.7/dist-packages/ubuntuone-control-panel',  '/usr/lib/python2.7/dist-packages/ubuntuone-couch',  '/usr/lib/python2.7/dist-packages/ubuntuone-installer',  '/usr/lib/python2.7/dist-packages/ubuntuone-storage-protocol',  '/usr/lib/python2.7/dist-packages/IPython/extensions']

0 个答案:

没有答案