FG
💻 Software

How to globally modify the default PYTHONPATH (sys.path)?

Fresh6 days ago
Mar 15, 2026170997 views
Confidence Score0%
0%

Problem

On a Ubuntu (10.10) system, I have a Python package that installs itself into . This isn't contained in the default path (sys.path). How do I add this directory to the path? Setting the environment variable is a solution, of course, but I'm looking for a more elegant way to do this. For example als…

Error Output

['', '/usr/local/lib/python2.6/dist-packages/keyring-0.5.1-py2.6.egg', 
'/usr/lib/python2.6', '/usr/lib/python2.6/plat-linux2', '/usr/lib/python2.6/l…

Unverified for your environment

Select your OS to check compatibility.

1 Fix

Canonical Fix
Unverified Fix
New Fix – Awaiting Verification

Fix for: How to globally modify the default PYTHONPATH (sys.path)?

Low Risk

The site module documentation and Modifying Python's Search Path seem to be what you're looking for. As far as I understand it, those entries are being added to by: (Change 2.6 to your version of Python.) The easiest way to change it is to add a fil…

Awaiting Verification

Be the first to verify this fix

Sign in to verify this fix

Environment