A way to get setup.py to create links instead of copy

Steve Holden steve at holdenweb.com
Tue Nov 9 18:33:09 CET 2010

On 11/9/2010 4:18 AM, Geoff Bache wrote:
> Hi all,
> One of the things I've always loved about Python (having come from
> compiled languages) was the lack of an extra step between changing my
> code and running it.
> On my current project, however, I find that I have to install my
> Python code with setup.py before it will run. Being used to not having
> this step, I easily forget to run setup.py install before they will
> run, and then spend time wondering why my changes didn't work.
> So I went into the target directory and replaced the copies with
> symbolic links back to the original code. This felt like a hack but
> does mean I don't have to install the whole time any more.
> I wonder if there is some standard way to deal with this situation?
Yes, there is. It involves (to a first approximation) understanding the
role of sys.path, and its relationship with the PYTHONPATH environment
variable. In brief, this tells the interpreter where to look for modules
when it is importing.

Installation with setup.py is normally reserved for a fairly permanent
insertion of the code into your Python distribution, which might have
added it for all users. If this is an issue you may want to undo the
installation manually by removing its additions to your Python's
Lib/site-packages directory.

Steve Holden           +1 571 484 6266   +1 800 494 3119
PyCon 2011 Atlanta March 9-17       http://us.pycon.org/
See Python Video!       http://python.mirocommunity.org/
Holden Web LLC                 http://www.holdenweb.com/

More information about the Python-list mailing list