0

I have to install python package locally/globally on a machine using pip, so for I do not want to install pip on local machine. I can successfully create a new virtual environment using

easy_install virtualenv-15.0.1.tar.gz    # (this package is present on machine)
mkdir /tmp/tmp_env
virtualenv /tmp/tmp_env/ENV
/tmp/tmp_env/ENV/bin/pip install PACKAGENAME

But when I do so it installs this package on virtual environment. I wish to install package on local environment so that even if I remove/deactivate virtualenv package should be present on local env.

0

When you're in a new Virtual env, anything you install will only be specific to that env. Move out to a global shell where you haven't sourced the new ENV or don't use /tmp/tmp_env/ENV/bin/pip install PACKAGENAME. Instead use the pip you have in the shell's global PATH.

1
  • Thank you. But I do not have pip on my localenv neither I want to download it on localenv. So can't we download any package from "pip in virtaulenv" to "localenv" – Nitesh S Apr 22 '16 at 6:32
0

You can try to have the pip in the virtualenv write to another location by user --user or --install-option:

 PYTHONUSERBASE=/path/to/your/dist-or-site-packages /tmp/tmp_env/ENV/bin/pip install --user

or

/tmp/tmp_env/ENV/bin/pip --install-option="--prefix=/path/to/python/install"

You should however not doing this kind of cludging at all. If you don't want to install pip, just install the PACKAGENAME with easy_install directly, or download the source packages tar.gz file, extract it and run

python setup.py install

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.