pip 之于 python 犹如 npm 之于 node.js,亦犹如 package control 之于 Sublime Text
不知什么原因 python3.5.2 安装完之后竟然没有 pip, 可是在安装向导里面确实有 pip 这个复选框(确认已勾选)。
无奈,自己安装吧。 在网上找一番,实在是五花八门,还是求助于官方文档 Installation 。
To install pip, securely download get-pip.py.
Then run the following:
python get-pip.py
Warning
Be cautious if you're using a Python install that's managed by your operating system or another package manager. get-pip.py
does not coordinate with those tools, and may leave your system in an inconsistent state.
get-pip.py
will also install setuptools and wheel, if they're not already. setuptools is required to install source distributions. Both are required to be able to build a Wheel Cache (which improves installation speed), although neither are required to install pre-built wheels.
点击那个 get-pip.py 的链接会看到 get-pip.py 的源码,将其保存为 python 脚本并执行即可安装 pip。好了,pip 已经安装完毕。
现在我们可以在命令行中使用 pip 了。
通过 pip 安装工具包,使用命令:
pip install xx
pip 卸载工具包的命令是 uninstall:
pip uninstall xx
下面我们来安装 Pygments。
pip install pygments
随后对一段代码进行语法高亮显示(命令行模式下),然后卸载 Pygments。
![](https://img.haomeiwen.com/i1957089/0eeaabc19de191e2.gif)
使用 pip show xx
显示工具包的相关信息,如下查看 pygments 的相关信息。
另外 使用 pip list 来列出已安装包
C:\Users\DELL\Desktop
λ pip show pygments
---
Metadata-Version: 2.0
Name: Pygments
Version: 2.1.3
Summary: Pygments is a syntax highlighting package written in Python.
Home-page: http://pygments.org/
Author: Georg Brandl
Author-email: georg@python.org
Installer: pip
License: BSD License
Location: c:\users\dell\appdata\local\programs\python\python35-32\lib\site-packages
Requires:
Classifiers:
License :: OSI Approved :: BSD License
Intended Audience :: Developers
Intended Audience :: End Users/Desktop
Intended Audience :: System Administrators
Development Status :: 6 - Mature
Programming Language :: Python
Programming Language :: Python :: 2
Programming Language :: Python :: 3
Operating System :: OS Independent
Topic :: Text Processing :: Filters
Topic :: Utilities
Entry-points:
[console_scripts]
pygmentize = pygments.cmdline:main
如果要对已经安装的工具包进行更新,使用 命令 pip install -U xx
更新 pip 本身:python -m pip install -U pip
![](https://img.haomeiwen.com/i1957089/bc844ccb2d5535cb.gif)
我们的 pip 已经是最新的了,无需更新。
顺便说一下我们这里用到的终端 Cmder,是 windows 平台上一个比较不错的终端,完全可以替代 自带的 cmd 和 powershell,而且它集成了 git 环境。
关于 Cmder 专门写了一篇 windows 上的终端 Cmder
网友评论