简体   繁体   中英

Where pip is located when installed with --user?

I have an account on a linux machine without root access. Python and pip are installed but I don't want to install their version, I want to install my own python.

So I went to http://pip.readthedocs.org/en/latest/installing.html and downloaded get-pip.py. Then I ran it with the existing python like this:

/usr/bin/python get-pip.py --user

Then the output was this:

/usr/lib/python2.6/site-packages/setuptools/command/install_scripts.py:3: UserWarning: Module pip was already imported from /tmp/tmpuuEbJv/pip.zip/pip/__init__.py, but /usr/lib/python2.6/site-packages is being added to sys.path
  from pkg_resources import Distribution, PathMetadata, ensure_directory
Downloading/unpacking pip from https://pypi.python.org/packages/py2.py3/p/pip/pip-1.5.6-py2.py3-none-any.whl#md5=4d4fb4b69df6731c7aea6300bc1f2
  Downloading pip-1.5.6-py2.py3-none-any.whl (1.0MB): 1.0MB downloaded
Installing collected packages: pip
Successfully installed pip
Cleaning up...

But now where is the new pip is installed? Which directory?

According to Alternate installation: the user scheme :

Files will be installed into subdirectories of site.USER_BASE (written as userbase hereafter). This scheme installs pure Python modules and extension modules in the same location (also known as site.USER_SITE). Here are the values for UNIX, including Mac OS X:

 Type of file | Installation directory -------------+--------------------------------------- modules | userbase/lib/pythonX.Y/site-packages scripts | userbase/bin data | userbase C headers | userbase/include/pythonX.Y/distname And here are the values used on Windows: Type of file | Installation directory -------------+--------------------------------------- modules | userbase\\PythonXY\\site-packages scripts | userbase\\Scripts data | userbase C headers | userbase\\PythonXY\\Include\\distname 

>>> import site
>>> site.USER_BASE  # `falsetru` is my username.
'/home/falsetru/.local'
>>> os.path.join(site.USER_BASE, 'bin')
'/home/falsetru/.local/bin'

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