简体   繁体   中英

How to install virtualenv scripts to /usr/bin

I install virtualenv with command sudo /usr/bin/pip-2.6 install virtualenv

And it says

Requirement already satisfied (use --upgrade to upgrade): 
virtualenv in /usr/local/lib/python2.6/dist-packages
Cleaning up...

Why pip from /usr/bin looks to /usr/local/lib?

I need to install virtualenv scripts directly to /usr/bin, so I write

sudo /usr/bin/pip-2.6 install --install-option="--install-scripts=/usr/bin" virtualenv

But again it responds with

Requirement already satisfied (use --upgrade to upgrade): 
virtualenv in /usr/local/lib/python2.6/dist-packages
Cleaning up...

Adding --upgrade doesn't help.

How can I install virtualenv scripts to /usr/bin ?

Try:

sudo /usr/bin/pip-2.6 install --install-option="--prefix=/usr/bin" virtualenv

( source ).

For your current issue can you first uninstall virtualenv using pip, and then reinstall using --script-dir=DIR, -s DIR as an --install-option .

As for your issue running pip with extra arguments and install not seeming to do anything, that may be fixed on develop branch at https://github.com/pypa/pip if not please file a bug with us on the GitHub issue tracker for pip.

As to why it is behaving like this - the install is based on the python installation not on the location of pip. Pip uses setuptools/distribute under the hood and conforms to the configuration of the python it is running under.

You can see where the version of python you are using installs to by running it - in this case probably python2.6 and querying the sys module.


>>> import sys
>>> sys.prefix
>>> sys.exec_prefix

See also distutils.sysconfig

For more information:

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM