如何在win7下安装win7 python pip包工具pip

you have been blocked博客访问: 21042
博文数量: 13
注册时间:
认证徽章:
学习数据库,以数据库为主线扩展学习,逐步实现“Oracle DBA - DBA - DA”的过渡,不断提高和完善自己的知识框架和技术能力,知行合一!
ITPUB论坛APP
ITPUB论坛APP
APP发帖 享双倍积分
IT168企业级官微
微信号:IT168qiye
系统架构师大会
微信号:SACC2013
分类: IT综合技术
Python有很多第三方的模块或包,要管理这些包,有很多方法。python的pip包管理工具,类似与CentOS中yum,使用该工具安装Python包非常方便。
从Python内部来说,pip 是一个安装和管理 Python 包的工具 , 是 easy_install 的一个替换品。
distribute是setuptools的取代(Setuptools包后期不再维护了),pip是easy_install的取代。
pip的安装前需要setuptools 或者 distribute,如果你使用的是Python3.x那么就只能使用distribute因为Python3.x不支持setuptools。
我的CentOS环境是Python 2.6,所以在之前已经按照好了setuptools,安装下面的步骤安装pip包管理工具。
1.pip工具的下载安装
pip下载命令为:
# cd /usr/local/src --路径可以根据情况修改
# wget "https://pypi.python.org/packages/source/p/pip/pip-1.5.4.tar.gz#md5=834baaac922bb" --no-check-certificate
pip 安装命令为:
# tar -xzvf pip-1.5.4.tar.gz
# cd pip-1.5.4
# python setup.py install
2.pip工具使用方法
pip安装一个包
# pip install SomePackage
&&Successfully installed SomePackage
pip列出已经安装的包
# pip list
pip查看已经安装的包
# pip show --files SomePackage
&&Name: SomePackage
&&Version: 1.0
&&Location: /my/env/lib/pythonx.x/site-packages
&&&../somepackage/__init__.py
pip检查哪些包需要更新
# pip list --outdated
&&SomePackage (Current: 1.0 Latest: 2.0)
&# pip install --upgrade SomePackage
&&Found existing installation: SomePackage 1.0
&&Uninstalling SomePackage:
&&&&Successfully uninstalled SomePackage
&&Running setup.py install for SomePackage
&&Successfully installed SomePackage
$ pip uninstall SomePackage
&&Uninstalling SomePackage:
&&&&/my/env/lib/pythonx.x/site-packages/somepackage
&&Proceed (y/n)? y
&&Successfully uninstalled SomePackage
3.pip命令参数解释
# pip --help
&&pip &command& [options]
&&uninstall
按着一定格式输出已安装包列表
列出已安装包.
显示包详细信息.
搜索包,类似yum里的search.
Build wheels from your requirements.
不推荐. Zip individual packages.
不推荐. Unzip individual packages.
不推荐. Create pybundles.
General Options:
&&-h, --help
&&-v, --verbose
更多的输出,最多可以使用3次
&&-V, --version
现实版本信息然后退出.
&&-q, --quiet
最少的输出.
&&--log-file &path& 覆盖的方式记录verbose错误日志,默认文件:/root/.pip/pip.log
&&--log &path& 不覆盖记录verbose输出的日志.
&&--proxy &proxy& Specify a proxy in the form [user:passwd@]proxy.server:port.
&&--timeout &sec& 连接超时时间 (默认15秒).
&&--exists-action &action& Default action when a path already exists: (s)witch, (i)gnore, (w)ipe, (b)ackup.
&&--cert &path& 证书.
4.pip管理包实际执行过程:
#使用pip 安装Python操作Excel的模块 XlsxWriter
# pip install XlsxWriter
Downloading/unpacking XlsxWriter
&&Downloading XlsxWriter-0.7.3-py2.py3-none-any.whl (132kB): 132kB downloaded
Installing collected packages: XlsxWriter
Successfully installed XlsxWriter
Cleaning up...
[root@centos01 pip-1.5.4]#
[root@centos01 pip-1.5.4]# pip list
Beaker (1.3.1)
cas (0.15)
decorator (3.0.1)
distribute (0.6.10)
ethtool (0.6)
firstboot (1.110)
FormEncode (1.3.0)
freeipa (2.0.0.alpha.0)
iniparse (0.3.1)
iotop (0.3.2)
ipapython (3.0.0)
iwlib (1.0)
kerberos (1.0)
lxml (2.2.3)
Mako (0.3.4)
MarkupSafe (0.9.2)
matplotlib (0.99.1.1)
netaddr (0.7.5)
nose (0.10.4)
numpy (1.4.1)
ordereddict (1.2)
paramiko (1.7.5)
pip (1.5.4)
psutil (2.0.0)
pycrypto (2.0.1)
pycurl (7.19.0)
PyDispatcher (2.0.5)
pygpgme (0.1)
pyOpenSSL (0.10)
python-dateutil (1.4.1)
python-default-encoding (0.1)
python-ldap (2.3.10)
python-meh (0.11)
python-nss (0.13)
pytz (2010h)
pyxdg (0.18)
scdate (1.9.60)
sckdump (2.0.5)
scservices (0.99.45)
scservices.dbus (0.99.45)
setuptools (18.2)
slip (0.2.20)
slip.dbus (0.2.20)
slip.gtk (0.2.20)
Warning: cannot find svn location for SQLObject==3.0.0a1dev-
SQLObject (3.0.0a1dev-)
SSSDConfig (1.9.2)
urlgrabber (3.9.1)
XlsxWriter (0.7.3)
yum-metadata-parser (1.1.2)
#使用pip 显示Python操作Excel的模块 XlsxWriter
# pip show --files XlsxWriter
Name: XlsxWriter
Version: 0.7.3
Location: /usr/lib/python2.6/site-packages
Cannot locate installed-files.txt
#使用pip 显示已经安装的Python的包
# pip list
Beaker (1.3.1)
cas (0.15)
decorator (3.0.1)
distribute (0.6.10)
ethtool (0.6)
firstboot (1.110)
FormEncode (1.3.0)
freeipa (2.0.0.alpha.0)
iniparse (0.3.1)
iotop (0.3.2)
ipapython (3.0.0)
iwlib (1.0)
kerberos (1.0)
lxml (2.2.3)
Mako (0.3.4)
MarkupSafe (0.9.2)
matplotlib (0.99.1.1)
netaddr (0.7.5)
nose (0.10.4)
numpy (1.4.1)
ordereddict (1.2)
paramiko (1.7.5)
pip (1.5.4)
psutil (2.0.0)
pycrypto (2.0.1)
pycurl (7.19.0)
PyDispatcher (2.0.5)
pygpgme (0.1)
pyOpenSSL (0.10)
python-dateutil (1.4.1)
python-default-encoding (0.1)
python-ldap (2.3.10)
python-meh (0.11)
python-nss (0.13)
pytz (2010h)
pyxdg (0.18)
scdate (1.9.60)
sckdump (2.0.5)
scservices (0.99.45)
scservices.dbus (0.99.45)
setuptools (18.2)
slip (0.2.20)
slip.dbus (0.2.20)
slip.gtk (0.2.20)
Warning: cannot find svn location for SQLObject==3.0.0a1dev-
SQLObject (3.0.0a1dev-)
SSSDConfig (1.9.2)
urlgrabber (3.9.1)
yum-metadata-parser (1.1.2)
[root@centos01 pip-1.5.4]
#使用pip 显示需要更新的包
# pip list --outdated
Warning: cannot find svn location for SQLObject==3.0.0a1dev-
psutil (Current: 2.0.0 Latest: 3.1.1)
pip (Current: 1.5.4 Latest: 7.1.2)
matplotlib (Current: 0.99.1.1 Latest: 1.4.3)
iwlib (Current: 1.0 Latest: 1.5)
pycrypto (Current: 2.0.1 Latest: 2.6.1)
pyOpenSSL (Current: 0.10 Latest: 0.15.1)
Could not find any downloads that satisfy the requirement python-default-encoding
Some externally hosted files were ignored (use --allow-external python-default-encoding to allow).
python-nss (Current: 0.13 Latest: 0.16.0)
MarkupSafe (Current: 0.9.2 Latest: 0.23)
lxml (Current: 2.2.3 Latest: 3.4.4)
pygpgme (Current: 0.1 Latest: 0.3)
pycurl (Current: 7.19.0 Latest: 7.19.5.1)
Could not find any downloads that satisfy the requirement ethtool
Some externally hosted files were ignored (use --allow-external ethtool to allow).
numpy (Current: 1.4.1 Latest: 1.9.2)
kerberos (Current: 1.0 Latest: 1.2.2)
Could not find any downloads that satisfy the requirement yum-metadata-parser
Some externally hosted files were ignored (use --allow-external yum-metadata-parser to allow).
python-ldap (Current: 2.3.10 Latest: 2.4.20)
Could not find any downloads that satisfy the requirement sckdump
Some externally hosted files were ignored (use --allow-external sckdump to allow).
Could not find any downloads that satisfy the requirement ipapython
Some externally hosted files were ignored (use --allow-external ipapython to allow).
Could not find any downloads that satisfy the requirement slip.gtk
Some externally hosted files were ignored (use --allow-external slip.gtk to allow).
Could not find any downloads that satisfy the requirement firstboot
Some externally hosted files were ignored (use --allow-external firstboot to allow).
Could not find any downloads that satisfy the requirement scdate
Some externally hosted files were ignored (use --allow-external scdate to allow).
Mako (Current: 0.3.4 Latest: 1.0.2)
Beaker (Current: 1.3.1 Latest: 1.7.0)
cas (Current: 0.15 Latest: 1.22)
distribute (Current: 0.6.10 Latest: 0.7.3)
Could not find any downloads that satisfy the requirement scservices.dbus
Some externally hosted files were ignored (use --allow-external scservices.dbus to allow).
python-dateutil (Current: 1.4.1 Latest: 2.4.2)
Could not find any downloads that satisfy the requirement sssdconfig
Some externally hosted files were ignored (use --allow-external sssdconfig to allow).
decorator (Current: 3.0.1 Latest: 4.0.2)
nose (Current: 0.10.4 Latest: 1.3.7)
Could not find any downloads that satisfy the requirement freeipa
Some externally hosted files were ignored (use --allow-external freeipa to allow).
iniparse (Current: 0.3.1 Latest: 0.4)
Could not find any downloads that satisfy the requirement slip.dbus
Some externally hosted files were ignored (use --allow-external slip.dbus to allow).
netaddr (Current: 0.7.5 Latest: 0.7.15)
paramiko (Current: 1.7.5 Latest: 1.15.2)
Could not find any downloads that satisfy the requirement python-meh
Some externally hosted files were ignored (use --allow-external python-meh to allow).
pytz (Current: 2010h Latest: 2015.4)
Could not find any downloads that satisfy the requirement scservices
Some externally hosted files were ignored (use --allow-external scservices to allow).
Could not find any downloads that satisfy the requirement iotop
Some externally hosted files were ignored (use --allow-external iotop to allow).
pyxdg (Current: 0.18 Latest: 0.25)
#使用pip 升级psutil模块
# pip install --upgrade psutil
Downloading/unpacking psutil from https://pypi.python.org/packages/source/p/psutil/psutil-3.1.1.tar.gz#md5=befb429cb18a4ac
&&Downloading psutil-3.1.1.tar.gz (247kB): 247kB downloaded
&&Running setup.py (path:/tmp/pip_build_root/psutil/setup.py) egg_info for package psutil
&&&&/tmp/pip_build_root/psutil/setup.py:12: DeprecationWarning: Parameters to load are deprecated. Call .resolve and .require separately.
&&&&&&import os
&&&&warning: no previously-included files matching '*' found under directory 'docs/_build'
&&&&warning: manifest_maker: MANIFEST.in, line 18: 'recursive-include' expects &dir& &pattern1& &pattern2& ...
Installing collected packages: psutil
&&Found existing installation: psutil 2.0.0
&&&&Uninstalling psutil:
&&&&&&Successfully uninstalled psutil
&&Running setup.py install for psutil
&&&&building 'psutil._psutil_linux' extension
&&&&gcc -pthread -fno-strict-aliasing -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -DPSUTIL_VERSION=311 -I/usr/include/python2.6 -c psutil/_psutil_linux.c -o build/temp.linux-x86_64-2.6/psutil/_psutil_linux.o
&&&&psutil/_psutil_linux.c: In function ‘psutil_proc_cpu_affinity_set’:
&&&&psutil/_psutil_linux.c:420: warning: suggest explicit braces to avoid ambiguous ‘else’
&&&&gcc -pthread -shared build/temp.linux-x86_64-2.6/psutil/_psutil_linux.o -L/usr/lib64 -lpython2.6 -o build/lib.linux-x86_64-2.6/psutil/_psutil_linux.so
&&&&building 'psutil._psutil_posix' extension
&&&&gcc -pthread -fno-strict-aliasing -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -I/usr/include/python2.6 -c psutil/_psutil_posix.c -o build/temp.linux-x86_64-2.6/psutil/_psutil_posix.o
&&&&gcc -pthread -shared build/temp.linux-x86_64-2.6/psutil/_psutil_posix.o -L/usr/lib64 -lpython2.6 -o build/lib.linux-x86_64-2.6/psutil/_psutil_posix.so
&&&&warning: no previously-included files matching '*' found under directory 'docs/_build'
&&&&warning: manifest_maker: MANIFEST.in, line 18: 'recursive-include' expects &dir& &pattern1& &pattern2& ...
Successfully installed psutil
Cleaning up...
#使用pip 卸载Python操作Excel的模块 XlsxWriter
[root@centos01 pip-1.5.4]# pip uninstall XlsxWriter
Uninstalling XlsxWriter:
&&/usr/bin/vba_extract.py
&&/usr/bin/vba_extract.pyc
&&/usr/lib/python2.6/site-packages/XlsxWriter-0.7.3.dist-info/DESCRIPTION.rst
&&/usr/lib/python2.6/site-packages/XlsxWriter-0.7.3.dist-info/METADATA
&&/usr/lib/python2.6/site-packages/XlsxWriter-0.7.3.dist-info/RECORD
&&/usr/lib/python2.6/site-packages/XlsxWriter-0.7.3.dist-info/WHEEL
&&/usr/lib/python2.6/site-packages/XlsxWriter-0.7.3.dist-info/metadata.json
&&/usr/lib/python2.6/site-packages/XlsxWriter-0.7.3.dist-info/top_level.txt
&&/usr/lib/python2.6/site-packages/xlsxwriter/__init__.py
&&/usr/lib/python2.6/site-packages/xlsxwriter/__init__.pyc
&&/usr/lib/python2.6/site-packages/xlsxwriter/app.py
&&/usr/lib/python2.6/site-packages/xlsxwriter/app.pyc
&&/usr/lib/python2.6/site-packages/xlsxwriter/chart.py
&&/usr/lib/python2.6/site-packages/xlsxwriter/chart.pyc
&&/usr/lib/python2.6/site-packages/xlsxwriter/chart_area.py
&&/usr/lib/python2.6/site-packages/xlsxwriter/chart_area.pyc
&&/usr/lib/python2.6/site-packages/xlsxwriter/chart_bar.py
&&/usr/lib/python2.6/site-packages/xlsxwriter/chart_bar.pyc
&&/usr/lib/python2.6/site-packages/xlsxwriter/chart_column.py
&&/usr/lib/python2.6/site-packages/xlsxwriter/chart_column.pyc
&&/usr/lib/python2.6/site-packages/xlsxwriter/chart_doughnut.py
&&/usr/lib/python2.6/site-packages/xlsxwriter/chart_doughnut.pyc
&&/usr/lib/python2.6/site-packages/xlsxwriter/chart_line.py
&&/usr/lib/python2.6/site-packages/xlsxwriter/chart_line.pyc
&&/usr/lib/python2.6/site-packages/xlsxwriter/chart_pie.py
&&/usr/lib/python2.6/site-packages/xlsxwriter/chart_pie.pyc
&&/usr/lib/python2.6/site-packages/xlsxwriter/chart_radar.py
&&/usr/lib/python2.6/site-packages/xlsxwriter/chart_radar.pyc
&&/usr/lib/python2.6/site-packages/xlsxwriter/chart_scatter.py
&&/usr/lib/python2.6/site-packages/xlsxwriter/chart_scatter.pyc
&&/usr/lib/python2.6/site-packages/xlsxwriter/chart_stock.py
&&/usr/lib/python2.6/site-packages/xlsxwriter/chart_stock.pyc
&&/usr/lib/python2.6/site-packages/xlsxwriter/chartsheet.py
&&/usr/lib/python2.6/site-packages/xlsxwriter/chartsheet.pyc
&&/usr/lib/python2.6/site-packages/xlsxwriter/comments.py
&&/usr/lib/python2.6/site-packages/xlsxwriter/comments.pyc
&&/usr/lib/python2.6/site-packages/xlsxwriter/compat_collections.py
&&/usr/lib/python2.6/site-packages/xlsxwriter/compat_collections.pyc
&&/usr/lib/python2.6/site-packages/xlsxwriter/compatibility.py
&&/usr/lib/python2.6/site-packages/xlsxwriter/compatibility.pyc
&&/usr/lib/python2.6/site-packages/xlsxwriter/contenttypes.py
&&/usr/lib/python2.6/site-packages/xlsxwriter/contenttypes.pyc
&&/usr/lib/python2.6/site-packages/xlsxwriter/core.py
&&/usr/lib/python2.6/site-packages/xlsxwriter/core.pyc
&&/usr/lib/python2.6/site-packages/xlsxwriter/drawing.py
&&/usr/lib/python2.6/site-packages/xlsxwriter/drawing.pyc
&&/usr/lib/python2.6/site-packages/xlsxwriter/format.py
&&/usr/lib/python2.6/site-packages/xlsxwriter/format.pyc
&&/usr/lib/python2.6/site-packages/xlsxwriter/packager.py
&&/usr/lib/python2.6/site-packages/xlsxwriter/packager.pyc
&&/usr/lib/python2.6/site-packages/xlsxwriter/relationships.py
&&/usr/lib/python2.6/site-packages/xlsxwriter/relationships.pyc
&&/usr/lib/python2.6/site-packages/xlsxwriter/shape.py
&&/usr/lib/python2.6/site-packages/xlsxwriter/shape.pyc
&&/usr/lib/python2.6/site-packages/xlsxwriter/sharedstrings.py
&&/usr/lib/python2.6/site-packages/xlsxwriter/sharedstrings.pyc
&&/usr/lib/python2.6/site-packages/xlsxwriter/styles.py
&&/usr/lib/python2.6/site-packages/xlsxwriter/styles.pyc
&&/usr/lib/python2.6/site-packages/xlsxwriter/table.py
&&/usr/lib/python2.6/site-packages/xlsxwriter/table.pyc
&&/usr/lib/python2.6/site-packages/xlsxwriter/theme.py
&&/usr/lib/python2.6/site-packages/xlsxwriter/theme.pyc
&&/usr/lib/python2.6/site-packages/xlsxwriter/utility.py
&&/usr/lib/python2.6/site-packages/xlsxwriter/utility.pyc
&&/usr/lib/python2.6/site-packages/xlsxwriter/vml.py
&&/usr/lib/python2.6/site-packages/xlsxwriter/vml.pyc
&&/usr/lib/python2.6/site-packages/xlsxwriter/workbook.py
&&/usr/lib/python2.6/site-packages/xlsxwriter/workbook.pyc
&&/usr/lib/python2.6/site-packages/xlsxwriter/worksheet.py
&&/usr/lib/python2.6/site-packages/xlsxwriter/worksheet.pyc
&&/usr/lib/python2.6/site-packages/xlsxwriter/xmlwriter.py
&&/usr/lib/python2.6/site-packages/xlsxwriter/xmlwriter.pyc
Proceed (y/n)? y
&&Successfully uninstalled XlsxWriter
阅读(1846) | 评论(0) | 转发(0) |
相关热门文章
给主人留下些什么吧!~~
请登录后评论。推荐这篇日记的豆列
······&&国之画&&&& &&
版权所有 京ICP备号-2
迷上了代码!Python相关(2)
这篇文章作为之前一篇写的的补充,在新机器上安装Python的扩展包的时候出现不能正常下载的情况,请过在网络上搜索之后找到了对应的解决办法,主要是服务器的为题,将其贴在这里与大家分享。
下面是国内提供的python的镜像服务器地址:
& 华中理工大学
& 山东理工大学
& 中国科学技术大学
使用方法:
python2 -m pip installelasticsearch -i
&--trusted-host
python3 -m pip installpandas -i
添加服务器地址,python3没有 --trusted-host 参数
这里写的python2和python3不是敲入的命令,是作为区别而写的,要在一台机子上兼容使用python2和python3还需要做些工作,有兴趣的读者可以自行找找资源和解决办法。
参考知识库
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
访问:1369次
排名:千里之外
原创:22篇
(6)(5)(2)(1)(2)(2)(1)(3)

我要回帖

更多关于 python pip使用 的文章

 

随机推荐