To give an example, if I run the command
sudo pip install gunicorn
There's now a file
/usr/local/bin/gunicorn
and a folder
/usr/local/lib/python2.7/site-packages/gunicorn
And I can run "gunicorn" from the shell.
However, if I run the command
sudo pip install gunicorn --target=~/tmp_directory
There's a folder at
~/tmp_directory/gunicorn
However, there is no "bin/gunicorn" anywhere and I cannot run "gunicorn" from the shell. Looking through the pip documentation I can't find anything for this particular case. The exact reason for my doing this is to try and setup a custom buildpack on Heroku.
You can
sudo ln -s ~/tmp_directory/gunicorn /usr/bin/gunicorn
.If I understand your needs correctly, you're suggested to try virtualenv, a tool to create isolated Python environments. You can install different versions of Python packages for each of your project on the same server. Highly recommended for Python development. I'm using virtualenvwrapper, a wrapper to make it a bit easier to use
I just found it's actually possible to tell 'pip' where to put scripts, data etc.
You can use
--install-option
to pass options to setuptools. So if you want to specify where to put scripts, you can:Now you have
gunicorn
command insidebin/
in current directory and package installed in target dirpython_modules
.An issue regarding this problem has been created on GitHub: https://github.com/pypa/pip/issues/3934
This is because the
--install-option="--install-scripts=$PWD/bin"
flag, that is necessary, cannot be used with.whl
files: