2

I would like to use a package in /usr/local/lib/python2.6/dist-packages/<this package>. But from what I checked from sys.path, this package is not in the path, so Python uses the package in /usr/lib/python2.6/dist-packages instead. How can I fix it?

1
  • 2
    Have you tried sys.path.append("/usr/local/lib/python2.6/dist-packages/")? (Or perhaps, since it looks like it's defaulting to another folder, sys.path = ["/usr/local/lib/python2.6/dist-packages/"] + sys.path?) Commented Apr 3, 2013 at 4:38

1 Answer 1

2

If this is for one script/program only I would just add to the top of the script:

import sys
sys.path.insert(0, '/usr/local/lib/python2.6/dist-packages')

If this happens more often then either remove the package from /usr/lib/python2.6/dist-packages if you can, or set the PYTHONPATH environment variable during login.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.