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?

2
  • 1
    I think stackoverflow.com/q/4517934/344286 answers my question, actually Commented Apr 23, 2014 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. Commented Apr 23, 2014 at 13:58

1 Answer 1

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!

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.