赞
踩
最简单的办法,安装anaconda之后,自然就能使用pip了,anaconda官网——https://www.anaconda.com/distribution/
官网安装pip参考地址:https://pip.pypa.io/en/stable/installing/
直接看博客 https://www.cnblogs.com/yuanzm/p/4089856.html?utm_source=tuicool&utm_medium=referral
进入https://pypi.python.org/pypi/pip,下载 ***.tar.gz压缩包
# tar -xzvf pip-1.5.4.tar.gz 解压
# cd pip-1.5.4 进入解压文件
# python setup.py install 安装
python -m pip install --upgrade pip
# pip install 安装包名
[...]
Successfully installed SomePackage #安装成功
# pip show --files 安装包名
Name:SomePackage # 包名
Version:1.0 # 版本号
Location:/my/env/lib/pythonx.x/site-packages # 安装位置
Files: # 包含文件等等
../somepackage/__init__.py
[...]
pip list
# pip list --outdated
包名 目前安装的版本号 最新的版本号
# pip install --upgrade 要升级的包名
安装指定版本的 Python 包,只需通过==操作符 。
安装tensorflow 1.13.1 版本(虚构的版本)
pip install tensorflow == 1.13.1
可以借助 pip-review 进行包的批量升级操作。
pip install pip-review
pip-review --local --interactive
或者
import pip
from subprocess import call
for dist in pip.get_installed_distributions():
call("pip install --upgrade " + dist.project_name, shell=True)
# pip uninstall 要卸载的包名
# pip install redis
# pip uninstall redis
Uninstalling redis:
/usr/lib/python3.6/site-packages/redis-2.9.1-py3.6.egg-info
.........
Proceed (y/n)? y
Successfully uninstalled redis # 卸载成功
# pip --help
Usage:
pip<command>[options]
Commands:
install 安装包.
uninstall 卸载包.
freeze 按着一定格式输出已安装包列表
list 列出已安装包.
show 显示包详细信息.
search 搜索包,类似yum里的search.
wheel Buildwheelsfromyourrequirements.
zip 不推荐.Zipindividualpackages.
unzip 不推荐.Unzipindividualpackages.
bundle 不推荐.Createpybundles.
help 当前帮助.
GeneralOptions:
-h,--help 显示帮助.
-v,--verbose 更多的输出,最多可以使用3次
-V,--version 现实版本信息然后退出.
-q,--quiet 最少的输出.
--log-file<path> 覆盖的方式记录verbose错误日志,默认文件:/root/.pip/pip.log
--log<path> 不覆盖记录verbose输出的日志.
--proxy<proxy> Specifyaproxyintheform[user:passwd@]proxy.server:port.
--timeout<sec> 连接超时时间(默认15秒).
--exists-action<action> Defaultactionwhenapathalreadyexists:(s)witch,(i)gnore,(w)ipe,(b)ackup.
--cert<path> 证书.
python课程推荐。
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。