0

This may be a bizarre use case/desire. With setup.py I can use the scripts parameter in the setup call to have it install some scripts, easy peasy. However, I plan on installing my application within a virtualenv, and I want my scripts to use the virtualenv python - not the default system install.

How can I do this?

Wayne Werner
  • 49,299
  • 29
  • 200
  • 290
  • 1
    I think http://stackoverflow.com/q/4517934/344286 answers my question, actually – Wayne Werner Apr 23 '14 at 13:54
  • It's not a bizarre use case at all. When deploying my flask apps for instance, I'm always using a virtualenv, although the applications are usually started using supervisord. – msvalkon Apr 23 '14 at 13:58

1 Answers1

1

Turns out setup.py is smarter than I thought - it automagically converts the hash-bang line to point to the python that it was installed with.

All you have to do is:

  • put #!/usr/bin/env python at the beginning of your script
  • make your script executable - $ chmod +x path/to/script
  • put the script in the setup function

setup( #stuff goes here scripts=['path/to/script'], )

  • (myenv) $ python setup.py develop (or install)

And magic happens!

Community
  • 1
  • 1
Wayne Werner
  • 49,299
  • 29
  • 200
  • 290