pip官网文档
https://pip.pypa.io/en/latest/reference/pip.html
若没有将c:\Python27\Scripts加入到path环境变量,可以在c:\Python27\Scripts目录下执行pip命令。
常用命令
1. 列出已安装的package
c:\Python27\Scripts>pip list
PIL (1.1.7)
pip (1.5.6)
py2exe (0.6.9)
pywin32 (219)
selenium (2.45.0)
SendKeys (0.3)
setuptools (0.6c11)
2. 列出已过期的package
c:\Python27\Scripts>pip list --outdated
pip (Current: 1.5.6 Latest: 6.0.8)
py2exe (Current: 0.6.9 Latest: 0.9.2.2)
Could not find any downloads that satisfy the requirement pywin32
Some externally hosted files were ignored (use --allow-external pywin32 to allow
).
setuptools (Current: 0.6c11 Latest: 14.0)
Could not find any downloads that satisfy the requirement pil
Some externally hosted files were ignored (use --allow-external pil to allow).
3. 安装或升级某package的最新版本
c:\Python27\Scripts>pip install --upgrade selenium 或 pip install -U selenium
Downloading/unpacking selenium from https://pypi.python.org/packages/source/s/se
lenium/selenium-2.45.0.tar.gz#md5=120813af730474a62a5a13058da4f602
Running setup.py (path:c:\users\baifeng\appdata\local\temp\pip_build_baifeng\s
elenium\setup.py) egg_info for package selenium
Installing collected packages: selenium
Found existing installation: selenium 2.44.0
Uninstalling selenium:
Successfully uninstalled selenium
Running setup.py install for selenium
Successfully installed selenium
Cleaning up...
4.安装特定版本的包
安装特定版本的package,通过使用==, >=, <=, >,
pip install robotframework==2.9.2
pip install robotframework<3.0
5. 卸载
c:\Python27\Scripts>pip uninstall SomePackage
6. 查看某个库的信息:
c:\Python27\Scripts>pip show selenium
Metadata-Version: 1.1
Name: selenium
Version: 2.47.0
Summary: Python bindings for Selenium
Home-page: https://github.com/SeleniumHQ/selenium/
Author: UNKNOWN
Author-email: UNKNOWN
License: UNKNOWN
Location: c:\python27\lib\site-packages
Requires: