python之pip包管理器与使用
pip是用来管理python的依赖包的包管理器,可以通过pip命令来管理python的包,具体的命令使用如下。
install 安装包.
download 下载包.
uninstall 卸载包.
freeze 将所有的pip管理的包以指定的格式进行输出到指定文件.
list 查看安装的所有的包.
show 查看安装包的具体信息.
#以下的命令可以参考使用
check Verify installed packages have compatible dependencies.
config Manage local and global configuration.
search Search PyPI for packages.
wheel Build wheels from your requirements.
hash Compute hashes of package archives.
completion A helper command used for command completion.
debug Show information useful for debugging.
help Show help for commands.
具体的使用命令如下
pip list #查看安装的包以及版本
pip install redis[==3.2.1] #安装redis,默认是安装最新版本
pip show redis #查看redis的详细信息
pip uninstall redis #卸载redis相关的包
#升级pip
python -m pip install --upgrade pip
pip -V #查看版本
pip freeze > ~/requirement.txt #将安装的包信息输出到~/requirement.txt中
pip install -r ~/requirement.txt #按指定的文件进行包的安装,常用语应用的迁移部署