1. 下載setuptools及pip的源碼包
setuptools與pip都是python的模塊
setuptools源碼包: https://pypi.python.org/pypi/setuptools
pip源碼包: https://pypi.python.org/pypi/pip#downloads
2. 安裝setuptools與pip
目前下載的版本是setuptools-12.0.5.tar.gz與pip-6.0.6.tar.gz
用tar命令解壓, 格式:tar -xzvf xxxx.tar.gz
先安裝setuptools, 進行setuptools的源碼根目錄下, 執行如下命令進行setuptools模塊的安裝:
[plain] view plaincopyhtml
# python setup.py install python
安裝完setuptools後, 接着安裝pip, 進入pip的源碼包根目錄下, 執行如下命令進行安裝:
[html] view plaincopyapp
# python setup.py build less
# python setup.py install socket
安裝完pip後. 看看pip都安裝在哪裏. 執行如下命令:
[plain] view plaincopyui
# whereis pip this
而後再執行 # pip 命令並回車, 若是沒法用pip命令, 則可經過建立pip軟連接, 執行如下命令:
[plain] view plaincopyspa
# ln -s /usr/local/bin/pip /usr/bin/pip code
好啦, 檢測pip命令是否正常:
[plain] view plaincopyorm
# pip
Usage:
pip <command> [options]
Commands:
install Install packages.
uninstall Uninstall packages.
freeze Output installed packages in requirements format.
list List installed packages.
show Show information about installed packages.
search Search PyPI for packages.
wheel Build wheels from your requirements.
zip DEPRECATED. Zip individual packages.
unzip DEPRECATED. Unzip individual packages.
help Show help for commands.
General Options:
-h, --help Show help.
--isolated Run pip in an isolated mode, ignoring
environment variables and user configuration.
-v, --verbose Give more output. Option is additive, and can be
used up to 3 times.
-V, --version Show version and exit.
-q, --quiet Give less output.
--log <path> Path to a verbose appending log.
--proxy <proxy> Specify a proxy in the form
[user:passwd@]proxy.server:port.
--retries <retries> Maximum number of retries each connection should
attempt (default 5 times).
--timeout <sec> Set the socket timeout (default 15 seconds).
--exists-action <action> Default action when a path already exists:
(s)witch, (i)gnore, (w)ipe, (b)ackup.
--trusted-host <hostname> Mark this host as trusted, even though it does
not have valid or any HTTPS.
--cert <path> Path to alternate CA bundle.
--client-cert <path> Path to SSL client certificate, a single file
containing the private key and the certificate
in PEM format.
--cache-dir <dir> Store the cache data in <dir>.
--no-cache-dir Disable the cache.
--disable-pip-version-check
Don't periodically check PyPI to determine
whether a new version of pip is available for
download. Implied with --no-index.
若是不建立軟連接, 也能夠直接使用pip的路徑來執行命令也是能夠的, 以下:
[plain] view plaincopy
# /usr/local/bin/pip
Usage:
pip <command> [options]
Commands:
install Install packages.
uninstall Uninstall packages.
freeze Output installed packages in requirements format.
list List installed packages.
show Show information about installed packages.
search Search PyPI for packages.
wheel Build wheels from your requirements.
zip DEPRECATED. Zip individual packages.
unzip DEPRECATED. Unzip individual packages.
help Show help for commands.
General Options:
-h, --help Show help.
--isolated Run pip in an isolated mode, ignoring
environment variables and user configuration.
-v, --verbose Give more output. Option is additive, and can be
used up to 3 times.
-V, --version Show version and exit.
-q, --quiet Give less output.
--log <path> Path to a verbose appending log.
--proxy <proxy> Specify a proxy in the form
[user:passwd@]proxy.server:port.
--retries <retries> Maximum number of retries each connection should
attempt (default 5 times).
--timeout <sec> Set the socket timeout (default 15 seconds).
--exists-action <action> Default action when a path already exists:
(s)witch, (i)gnore, (w)ipe, (b)ackup.
--trusted-host <hostname> Mark this host as trusted, even though it does
not have valid or any HTTPS.
--cert <path> Path to alternate CA bundle.
--client-cert <path> Path to SSL client certificate, a single file
containing the private key and the certificate
in PEM format.
--cache-dir <dir> Store the cache data in <dir>.
--no-cache-dir Disable the cache.
--disable-pip-version-check
Don't periodically check PyPI to determine
whether a new version of pip is available for
download. Implied with --no-index.
OK, Enjoy it!!!