我在没有root访问权限的linux机器上有一个帐户。安装了Python和pip,但我不想安装他们的版本,我想安装自己的python。
所以我去了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 :(得分:1)
根据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'