redhat6.5安装pip问题及解决

    本篇文章,介绍我自己在redhat6.5中安装pip遇到的问题,权当自己笔记,如果能帮到其他人,与有荣焉!


   这次是首先我是升级了下Python,Python原来为2.6.6

[root@zabbix-server bin]# ./python_old 
Python 2.6.6 (r266:84292, Sep  4 2013, 07:46:00) 
[GCC 4.4.7 20120313 (Red Hat 4.4.7-3)] on linux2
Type "help", "copyright", "credits" or "license" for more information.

  现在升级到Python2.7

[root@zabbix-server bin]# python
Python 2.7.13 (default, May 25 2017, 03:28:01) 
[GCC 4.4.7 20120313 (Red Hat 4.4.7-4)] on linux2
Type "help", "copyright", "credits" or "license" for more information.


之前安装PIP报错的截图发现在ssh中已经被刷出了,就简单描述下解决方法吧

安装PIP时,首先要安装setuptools包

setuptools包安装又需要安装以下包

#安装six-1.10.0.tar.gz
#安装packaging-16.8.tar.gz
#安装pyparsing-2.2.0.tar.gz
#安装appdirs-1.4.3.tar.gz

这些包在Python官网都可以搜索到,下载后解压,然后执行以下命令安装即可

python setup.py install


最后安装pip也用以上命令,即可安装成功


[root@zabbix-server soft]# pip -V
pip 9.0.1 from /usr/local/python27/lib/python2.7/site-packages/pip-9.0.1-py2.7.egg (python 2.7)



我们也可以用pip下载安装包,或者安装各种Python包

[root@zabbix-server soft]# pip download requests
Collecting requests
  Using cached requests-2.14.2-py2.py3-none-any.whl
  Saved ./requests-2.14.2-py2.py3-none-any.whl
Successfully downloaded requests




这个问题其实比较奇怪,因为相同版本的Python,我在windows安装后直接下载pip安装没有任何问题,在Linux反而有问题。

而且Python在windows 与Linux下目录结构也不通。记录一下


windows下目录结构

redhat6.5安装pip问题及解决_第1张图片



Linux下的目录结构


[root@zabbix-server python27]# tree -d -L 3
.
?..?€ bin
?..?€ include
?...?..?€ python2.7
?..?€ lib
?...?..?€ pkgconfig
?...?..?€ python2.7
?...    ?..?€ bsddb
?...    ?..?€ compiler
?...    ?..?€ config
?...    ?..?€ ctypes
?...    ?..?€ curses
?...    ?..?€ distutils
?...    ?..?€ email
?...    ?..?€ encodings
?...    ?..?€ ensurepip
?...    ?..?€ hotshot
?...    ?..?€ idlelib
?...    ?..?€ importlib
?...    ?..?€ json
?...    ?..?€ lib2to3
?...    ?..?€ lib-dynload
?...    ?..?€ lib-tk
?...    ?..?€ logging
?...    ?..?€ multiprocessing
?...    ?..?€ plat-linux2
?...    ?..?€ pydoc_data
?...    ?..?€ site-packages
?...    ?..?€ sqlite3
?...    ?..?€ test
?...    ?..?€ unittest
?...    ?..?€ wsgiref
?...    ?..?€ xml
?..?€ share
    ?..?€ man
        ?..?€ man1

35 directories







你可能感兴趣的:(python)