python的pip管理工具
Python有两个著名的包管理工具easy_install.py和pip。在Python2.7的安装包中,easy_install.py是默认安装的,而pip需要我们手动安装。
在此进行编译安装pip管理工具,下载地址:https://pypi.org/project/pip/#files
现在的pip版本是pip-10.0.1,支持python2.x和python3.x
1、下载文件,然后解压
tar -xf pip-10.0..tar.gz
2、查看pip文件内容
[root@python pip-10.0.]# ls
AUTHORS.txt dist LICENSE.txt NEWS.rst pyproject.toml setup.cfg src
build docs MANIFEST.in PKG-INFO README.rst setup.py
3、安装pip
[root@python pip-10.0.]# python setup.py install
4、查看pip安装成功版本
[root@python pip-10.0.]# pip -V
pip 10.0. from /usr/lib/python2./site-packages/pip-10.0.-py2..egg/pip (python 2.7)
5、测试安装psutil模块
[root@python ~]# pip install psutil
出现以下问题
Collecting psutil
Downloading https://files.pythonhosted.org/packages/51/9e/0f8f5423ce28c9109807024f7bdde776ed0b1161de20b408875de7e030c3/psutil-5.4.6.tar.gz (418kB)
% |████████████████████████████████| 419kB 227kB/s
ipaclient 4.5. requires jinja2, which is not installed.
rtslib-fb 2.1. has requirement pyudev>=0.16., but you'll have pyudev 0.15 which is incompatible.
ipapython 4.5. has requirement dnspython>=1.15, but you'll have dnspython 1.12.0 which is incompatible.
Installing collected packages: psutil
Running setup.py install for psutil ... error
Complete output from command /bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-BO0YvS/psutil/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-record-FbEPxr/install-record.txt --single-version-externally-managed --compile:
/usr/lib64/python2./distutils/dist.py:: UserWarning: Unknown distribution option: 'python_requires'
warnings.warn(msg)
running install
running build
running build_py
creating build
creating build/lib.linux-x86_64-2.7
creating build/lib.linux-x86_64-2.7/psutil
copying psutil/_exceptions.py -> build/lib.linux-x86_64-2.7/psutil
copying psutil/_psposix.py -> build/lib.linux-x86_64-2.7/psutil
copying psutil/_psbsd.py -> build/lib.linux-x86_64-2.7/psutil
copying psutil/_psaix.py -> build/lib.linux-x86_64-2.7/psutil
copying psutil/_pssunos.py -> build/lib.linux-x86_64-2.7/psutil
copying psutil/_pslinux.py -> build/lib.linux-x86_64-2.7/psutil
copying psutil/_common.py -> build/lib.linux-x86_64-2.7/psutil
copying psutil/__init__.py -> build/lib.linux-x86_64-2.7/psutil
copying psutil/_psosx.py -> build/lib.linux-x86_64-2.7/psutil
copying psutil/_compat.py -> build/lib.linux-x86_64-2.7/psutil
copying psutil/_pswindows.py -> build/lib.linux-x86_64-2.7/psutil
creating build/lib.linux-x86_64-2.7/psutil/tests
copying psutil/tests/__main__.py -> build/lib.linux-x86_64-2.7/psutil/tests
copying psutil/tests/test_bsd.py -> build/lib.linux-x86_64-2.7/psutil/tests
copying psutil/tests/test_contracts.py -> build/lib.linux-x86_64-2.7/psutil/tests
copying psutil/tests/test_aix.py -> build/lib.linux-x86_64-2.7/psutil/tests
copying psutil/tests/test_memory_leaks.py -> build/lib.linux-x86_64-2.7/psutil/tests
copying psutil/tests/test_connections.py -> build/lib.linux-x86_64-2.7/psutil/tests
copying psutil/tests/test_system.py -> build/lib.linux-x86_64-2.7/psutil/tests
copying psutil/tests/test_linux.py -> build/lib.linux-x86_64-2.7/psutil/tests
copying psutil/tests/test_misc.py -> build/lib.linux-x86_64-2.7/psutil/tests
copying psutil/tests/__init__.py -> build/lib.linux-x86_64-2.7/psutil/tests
copying psutil/tests/test_osx.py -> build/lib.linux-x86_64-2.7/psutil/tests
copying psutil/tests/test_process.py -> build/lib.linux-x86_64-2.7/psutil/tests
copying psutil/tests/test_windows.py -> build/lib.linux-x86_64-2.7/psutil/tests
copying psutil/tests/test_posix.py -> build/lib.linux-x86_64-2.7/psutil/tests
copying psutil/tests/test_sunos.py -> build/lib.linux-x86_64-2.7/psutil/tests
copying psutil/tests/test_unicode.py -> build/lib.linux-x86_64-2.7/psutil/tests
running build_ext
building 'psutil._psutil_linux' extension
creating build/temp.linux-x86_64-2.7
creating build/temp.linux-x86_64-2.7/psutil
gcc -pthread -fno-strict-aliasing -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE= -fexceptions -fstack-protector-strong --param=ssp-buffer-size= -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE= -fexceptions -fstack-protector-strong --param=ssp-buffer-size= -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -DPSUTIL_POSIX= -DPSUTIL_VERSION= -DPSUTIL_LINUX= -I/usr/include/python2. -c psutil/_psutil_common.c -o build/temp.linux-x86_64-2.7/psutil/_psutil_common.o
psutil/_psutil_common.c:9:20: 致命错误:Python.h:没有那个文件或目录
#include <Python.h>
^
编译中断。
error: command 'gcc' failed with exit status 1 ----------------------------------------
Command "/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-BO0YvS/psutil/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-record-FbEPxr/install-record.txt --single-version-externally-managed --compile" failed with error code in /tmp/pip-install-BO0YvS/psutil/
解决方法:
安装python-devel,这是python的头文件和静态库包
[root@python ~]# yum install python-devel
6、再次安装psutil模块
[root@python ~]# pip install psutil
Collecting psutil
Using cached https://files.pythonhosted.org/packages/51/9e/0f8f5423ce28c9109807024f7bdde776ed0b1161de20b408875de7e030c3/psutil-5.4.6.tar.gz
ipaclient 4.5. requires jinja2, which is not installed.
rtslib-fb 2.1. has requirement pyudev>=0.16., but you'll have pyudev 0.15 which is incompatible.
ipapython 4.5. has requirement dnspython>=1.15, but you'll have dnspython 1.12.0 which is incompatible.
Installing collected packages: psutil
Running setup.py install for psutil ... done
Successfully installed psutil-5.4.
致此,pip安装成功,可以安装自已想要的模块,解决模块的依赖关系。
python的pip管理工具的更多相关文章
- python安装pip管理工具
(1)安装python2.7.5,这里我选择安装在C盘根目录下. (2)安装完毕后C盘会生成一个叫“python27”的文件夹. (3)打开python27,会发现该目录下存在一个叫Scripts的文 ...
- Python的包管理工具Pip (zz )
Python的包管理工具Pip 接触了Ruby,发现它有个包管理工具RubyGem很好用,并且有很完备的文档系统http://rdoc.info 发现Python下也有同样的工具,包括easy_ins ...
- Windows 安装 pip管理工具
Step 1: 设置Python环境变量(我的Python 是 2.7.3) SETX PATH "%path%;D:\python;D:\python\Scripts" 也可以在 ...
- Python的包管理工具
Python的包管理工具 作者:尹正杰 版权声明:原创作品,谢绝转载!否则将追究法律责任. 一.为什么使用包管理 Python的模块或者源文件直接可以复制到目标项目目录中,就可以导入使用了. 但是为了 ...
- 【转载】Python的包管理工具Pip
接触了Ruby,发现它有个包管理工具RubyGem很好用,并且有很完备的文档系统http://rdoc.info 发现Python下也有同样的工具,包括easy_install和Pip.不过,我没有细 ...
- Python的包管理工具Pip
接触了Ruby,发现它有个包管理工具RubyGem非常好用,而且有非常完备的文档系统http://rdoc.info 发现Python下也有相同的工具,包含easy_install和Pip.只是,我没 ...
- window环境下安装 pip 工具 【pip为Python的扩展管理工具】
Python有一些扩展管理工具,例如easy_install和pip工具,我推荐各位使用pip工具,因为pip工具具有很好的安装和卸载体验. 我们首先需要打开pip的官方网站, 下载必要的文件包,然后 ...
- Python之包管理工具:distutils、setuptools、distribute、setup.py、easy_install、easy_install、pip
在安装Python包的过程中,经常涉及到distutils.setuptools.distribute.setup.py.easy_install.easy_install和pip等等. 介绍:htt ...
- 5、Python之包管理工具pip
pip提供我们各色各样的软件(第三方库),而这些第三方库又可以给我们实现各种各样不同的功能,科学计算.画图.操作文件.聊天-- 我们可以通过Cmd终端.Pycharm.Jupyter三种平台使用pip ...
随机推荐
- Running several name-based web sites on a single IP address.
VirtualHost Examples - Apache HTTP Server Version 2.2 http://httpd.apache.org/docs/2.2/vhosts/exampl ...
- Android笔记之manifestPlaceholders
有时根据项目需要,AndroidManifest.xml中的meta-data的值分测试和正式 为了能自动地更换meta-data值,就需要用到manifestPlaceholders 语法:mani ...
- linux内核container_of宏定义分析
看见一个哥们分析container_of很好,转来留给自己看 一.#define offsetof(TYPE, MEMBER) ((size_t) & ((TYPE *)0)->MEMB ...
- Zookeeper实现Master选举(哨兵机制)
master选举使用场景及结构 现在很多时候我们的服务需要7*24小时工作,假如一台机器挂了,我们希望能有其它机器顶替它继续工作.此类问题现在多采用master-salve模式,也就是常说的主从模式, ...
- Java内存模型(JMM)中的happens-before
happens-before是JMM中最核心的概念,对于Java程序员来说,理解happens-before是理解JMM的关键 . 1.JMM的设计 首先,来看看JMM的设计意图.从JMM的设计者的角 ...
- 继续servlet理论篇
唉,毕业是件很麻烦的事情,实习也是一件很郁闷的事情,现在公司很注重基础,所以 所以还要看java,不过,我年轻,我有激情.来吧,来着不惧,说这话,有些心虚. HttpServlet类中所提供的doGe ...
- 避免复杂的layout
layout是浏览器计算元素的几何信息:元素在页面上的的大小和位置. 每个元素都有明确的亦或含蓄的大小信息,这些信息基于我们使用的css以及元素的内容被高和父亲元素. 这个过程在 Chrome, Op ...
- python中类的定义方法
# coding =utf-8 ## 类的定义 ##-------------------------------------------------- class Employee: empCoun ...
- inline关键字的用法详解
1. 引入inline关键字的原因 在c/c++中,为了解决一些频繁调用的小函数大量消耗栈空间(栈内存)的问题,特别的引入了inline修饰符,表示为内联函数. 栈空间就是指放置程序的局部数据(也就是 ...
- HDU2874(LCA应用:求两点之间距离,图不连通)
Connections between cities Time Limit: 10000/5000 MS (Java/Others) Memory Limit: 32768/32768 K (J ...