Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想在/usr/local/lib/python2.6/dist-packages/<this package>. 但是从我检查的内容来看sys.path,这个包不在路径中,所以 Python 使用了这个包/usr/lib/python2.6/dist-packages。我该如何解决?
/usr/local/lib/python2.6/dist-packages/<this package>
sys.path
/usr/lib/python2.6/dist-packages
如果这仅适用于一个脚本/程序,我只会添加到脚本的顶部:
import sys sys.path.insert(0, '/usr/local/lib/python2.6/dist-packages')
/usr/lib/python2.6/dist-packages如果这种情况更频繁地发生,那么如果可以的话,要么删除包,要么PYTHONPATH在登录期间设置环境变量。
PYTHONPATH