2014-10-09 151 views
1

我有一台没有root访问权限的Linux机器上的帐户。 Python和PIP已安装,但我不想安装它们的版本,我想安装我自己的Python。使用--user安装时,pip位于何处?

所以我去了http://pip.readthedocs.org/en/latest/installing.html并下载了get-pip.py。然后,我用这样的现有的Python运行它:

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

然后输出是这样的:

/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... 

但现在是在安装新的点子在哪里?哪个目录?

回答

0

根据Alternate installation: the user scheme

文件将被安装到site.USER_BASE的子目录(书面 如下文的用户群)。该方案将纯Python模块和 扩展模块安装在同一位置(也称为site.USER_SITE)。 以下是UNIX的价值观,包括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'