系统相关
首页 > 系统相关> > Centos7使用yum安装 python3 、 pip 、ipython

Centos7使用yum安装 python3 、 pip 、ipython

作者:互联网

新查看系统是否有可用的python3安装包

yum list python3

如果没有的话 提示的以下内容!

如果没有可用的python3 安装包,则先

yum install -y epel-release
yum install -y python3 python3-devel

 

 

在安装python之后安装ipython可以极大的方便我们学习和使用python,更多的精力集中于如何处理代码和需要解决的问题,ipython的功能还是相当不错的,那么我们如何在win系统上安装ipython呢?

 

 

安装ipython的方法:

首先确保电脑已经成功安装了python,输入命令python查看当前python是否已经成功安装

 

 

 

安装epel扩展源

yum -y install epel-release

执行如下:

[root@server01 work]# yum -y install epel-release
Loaded plugins: fastestmirror
Determining fastest mirrors
 * base: centos.ustc.edu.cn
 * extras: mirrors.aliyun.com
 * updates: mirrors.aliyun.com
base                                                            | 3.6 kB  00:00:00     
extras                                                          | 3.4 kB  00:00:00     
updates                                                         | 3.4 kB  00:00:00     
extras/7/x86_64/primary_db                                      | 156 kB  00:00:00     
Resolving Dependencies
--> Running transaction check
---> Package epel-release.noarch 0:7-11 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

=======================================================================================
 Package                  Arch               Version          Repository          Size
=======================================================================================
Installing:
 epel-release             noarch             7-11             extras              15 k

Transaction Summary
=======================================================================================
Install  1 Package

Total download size: 15 k
Installed size: 24 k
Downloading packages:
epel-release-7-11.noarch.rpm                                    |  15 kB  00:00:00     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : epel-release-7-11.noarch                                            1/1 
  Verifying  : epel-release-7-11.noarch                                            1/1 

Installed:
  epel-release.noarch 0:7-11                                                           

Complete!
[root@server01 work]# 

使用yum安装pip

yum -y install python-pip

执行如下:

[root@server01 work]# yum -y install python-pip
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
epel/x86_64/metalink                                                                                                                                                                      | 6.6 kB  00:00:00     
 * base: centos.ustc.edu.cn
 * epel: mirror01.idc.hinet.net
 * extras: mirrors.aliyun.com
 * updates: mirrors.aliyun.com
epel                                                                                                                                                                                      | 3.2 kB  00:00:00     
(1/3): epel/x86_64/group_gz                                                                                                                                                               |  88 kB  00:00:00     
(2/3): epel/x86_64/updateinfo                                                                                                                                                             | 940 kB  00:00:00     
(3/3): epel/x86_64/primary                                                                                                                                                                | 3.6 MB  00:00:49     
epel                                                                                                                                                                                                 12743/12743
Resolving Dependencies
--> Running transaction check
....
Total                                                                                                                                                                            164 kB/s | 2.1 MB  00:00:13     
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
Importing GPG key 0x352C64E5:
 Userid     : "Fedora EPEL (7) <epel@fedoraproject.org>"
 Fingerprint: 91e9 7d7c 4a5e 96f1 7f3e 888f 6a2f aea2 352c 64e5
 Package    : epel-release-7-11.noarch (@extras)
 From       : /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : python-backports-1.0-8.el7.x86_64                                                                                                                                                             1/5 
  Installing : python-ipaddress-1.0.16-2.el7.noarch                                                                                                                                                          2/5 
  Installing : python-backports-ssl_match_hostname-3.5.0.1-1.el7.noarch                                                                                                                                      3/5 
  Installing : python-setuptools-0.9.8-7.el7.noarch                                                                                                                                                          4/5 
  Installing : python2-pip-8.1.2-6.el7.noarch                                                                                                                                                                5/5 
  Verifying  : python-ipaddress-1.0.16-2.el7.noarch                                                                                                                                                          1/5 
  Verifying  : python-setuptools-0.9.8-7.el7.noarch                                                                                                                                                          2/5 
  Verifying  : python2-pip-8.1.2-6.el7.noarch                                                                                                                                                                3/5 
  Verifying  : python-backports-1.0-8.el7.x86_64                                                                                                                                                             4/5 
  Verifying  : python-backports-ssl_match_hostname-3.5.0.1-1.el7.noarch                                                                                                                                      5/5 

Installed:
  python2-pip.noarch 0:8.1.2-6.el7                                                                                                                                                                               

Dependency Installed:
  python-backports.x86_64 0:1.0-8.el7         python-backports-ssl_match_hostname.noarch 0:3.5.0.1-1.el7         python-ipaddress.noarch 0:1.0.16-2.el7         python-setuptools.noarch 0:0.9.8-7.el7        

Complete!
[root@server01 work]# 

安装ipython

pip install ipython

执行如下:

[root@server01 work]# pip install ipython
Collecting ipython
  Downloading https://files.pythonhosted.org/packages/42/bb/0ed1fb1d57d697326f9e9b827d9a74b81dee56031ed7c252bc716195ad7a/ipython-7.2.0.tar.gz (5.1MB)
    100% |████████████████████████████████| 5.1MB 46kB/s 
    Complete output from command python setup.py egg_info:
    
    IPython 7.0+ supports Python 3.5 and above.
    When using Python 2.7, please install IPython 5.x LTS Long Term Support version.
    Python 3.3 and 3.4 were supported up to IPython 6.x.
    
    See IPython `README.rst` file for more information:
    
        https://github.com/ipython/ipython/blob/master/README.rst
    
    Python sys.version_info(major=2, minor=7, micro=5, releaselevel='final', serial=0) detected.
    Your pip version is out of date, please install pip >= 9.0.1. pip 8.1.2 detected.
    
    
    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-yqbpuw/ipython/
You are using pip version 8.1.2, however version 18.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
[root@server01 work]# 

从错误提示中得知还需要对pip进行升级。

pip升级

pip install --upgrade pip

执行如下:

[root@server01 work]# pip install --upgrade pip
Collecting pip
  Downloading https://files.pythonhosted.org/packages/c2/d7/90f34cb0d83a6c5631cf71dfe64cc1054598c843a92b400e55675cc2ac37/pip-18.1-py2.py3-none-any.whl (1.3MB)
    100% |████████████████████████████████| 1.3MB 1.2MB/s 
Installing collected packages: pip
  Found existing installation: pip 8.1.2
    Uninstalling pip-8.1.2:
      Successfully uninstalled pip-8.1.2
Successfully installed pip-18.1
[root@server01 work]# 

更新了pip的版本之后,再次安装ipython看看。

再次安装ipython

pip install ipython

执行如下:

[root@server01 work]# pip install ipython
Collecting ipython
  Downloading https://files.pythonhosted.org/packages/b0/88/d996ab8be22cea1eaa18baee3678a11265e18cf09974728d683c51102148/ipython-5.8.0-py2-none-any.whl (760kB)
    100% |████████████████████████████████| 768kB 42kB/s 
Collecting pathlib2; python_version == "2.7" or python_version == "3.3" (from ipython)
  Downloading https://files.pythonhosted.org/packages/2a/46/c696dcf1c7aad917b39b875acdc5451975e3a9b4890dca8329983201c97a/pathlib2-2.3.3-py2.py3-none-any.whl
Collecting traitlets>=4.2 (from ipython)
  Downloading https://files.pythonhosted.org/packages/93/d6/abcb22de61d78e2fc3959c964628a5771e47e7cc60d53e9342e21ed6cc9a/traitlets-4.3.2-py2.py3-none-any.whl (74kB)
    100% |████████████████████████████████| 81kB 38kB/s 
Collecting backports.shutil-get-terminal-size; python_version == "2.7" (from ipython)
  Downloading https://files.pythonhosted.org/packages/7d/cd/1750d6c35fe86d35f8562091737907f234b78fdffab42b29c72b1dd861f4/backports.shutil_get_terminal_size-1.0.0-py2.py3-none-any.whl
Collecting simplegeneric>0.8 (from ipython)
  Downloading https://files.pythonhosted.org/packages/3d/57/4d9c9e3ae9a255cd4e1106bb57e24056d3d0709fc01b2e3e345898e49d5b/simplegeneric-0.8.1.zip
Collecting pygments (from ipython)
  Downloading https://files.pythonhosted.org/packages/fc/41/4f900a7852e25bb9350b4e3ee8c4aba0ee32abefd401456962b25f954823/Pygments-2.3.0-py2.py3-none-any.whl (845kB)
    100% |████████████████████████████████| 849kB 19kB/s 
Collecting pexpect; sys_platform != "win32" (from ipython)
  Downloading https://files.pythonhosted.org/packages/89/e6/b5a1de8b0cc4e07ca1b305a4fcc3f9806025c1b651ea302646341222f88b/pexpect-4.6.0-py2.py3-none-any.whl (57kB)
    100% |████████████████████████████████| 61kB 31kB/s 
Collecting setuptools>=18.5 (from ipython)
  Downloading https://files.pythonhosted.org/packages/37/06/754589caf971b0d2d48f151c2586f62902d93dc908e2fd9b9b9f6aa3c9dd/setuptools-40.6.3-py2.py3-none-any.whl (573kB)
    100% |████████████████████████████████| 573kB 28kB/s 
Collecting prompt-toolkit<2.0.0,>=1.0.4 (from ipython)
  Downloading https://files.pythonhosted.org/packages/d1/b0/1a6c262da35c779dd79550137aa7c298a424987240a28792ec5ccf48f848/prompt_toolkit-1.0.15-py2-none-any.whl (247kB)
    100% |████████████████████████████████| 256kB 28kB/s 
Collecting pickleshare (from ipython)
  Downloading https://files.pythonhosted.org/packages/9a/41/220f49aaea88bc6fa6cba8d05ecf24676326156c23b991e80b3f2fc24c77/pickleshare-0.7.5-py2.py3-none-any.whl
Requirement already satisfied: decorator in /usr/lib/python2.7/site-packages (from ipython) (3.4.0)
Collecting six (from pathlib2; python_version == "2.7" or python_version == "3.3"->ipython)
  Downloading https://files.pythonhosted.org/packages/73/fb/00a976f728d0d1fecfe898238ce23f502a721c0ac0ecfedb80e0d88c64e9/six-1.12.0-py2.py3-none-any.whl
Collecting scandir; python_version < "3.5" (from pathlib2; python_version == "2.7" or python_version == "3.3"->ipython)
  Downloading https://files.pythonhosted.org/packages/16/2a/557af1181e6b4e30254d5a6163b18f5053791ca66e251e77ab08887e8fe3/scandir-1.9.0.tar.gz
Collecting enum34; python_version == "2.7" (from traitlets>=4.2->ipython)
  Downloading https://files.pythonhosted.org/packages/c5/db/e56e6b4bbac7c4a06de1c50de6fe1ef3810018ae11732a50f15f62c7d050/enum34-1.1.6-py2-none-any.whl
Collecting ipython-genutils (from traitlets>=4.2->ipython)
  Downloading https://files.pythonhosted.org/packages/fa/bc/9bd3b5c2b4774d5f33b2d544f1460be9df7df2fe42f352135381c347c69a/ipython_genutils-0.2.0-py2.py3-none-any.whl
Collecting ptyprocess>=0.5 (from pexpect; sys_platform != "win32"->ipython)
  Downloading https://files.pythonhosted.org/packages/d1/29/605c2cc68a9992d18dada28206eeada56ea4bd07a239669da41674648b6f/ptyprocess-0.6.0-py2.py3-none-any.whl
Collecting wcwidth (from prompt-toolkit<2.0.0,>=1.0.4->ipython)
  Downloading https://files.pythonhosted.org/packages/7e/9f/526a6947247599b084ee5232e4f9190a38f398d7300d866af3ab571a5bfe/wcwidth-0.1.7-py2.py3-none-any.whl
Installing collected packages: six, scandir, pathlib2, enum34, ipython-genutils, traitlets, backports.shutil-get-terminal-size, simplegeneric, pygments, ptyprocess, pexpect, setuptools, wcwidth, prompt-toolkit, pickleshare, ipython
  Running setup.py install for scandir ... done
  Running setup.py install for simplegeneric ... done
  Found existing installation: setuptools 0.9.8
    Uninstalling setuptools-0.9.8:
      Successfully uninstalled setuptools-0.9.8
Successfully installed backports.shutil-get-terminal-size-1.0.0 enum34-1.1.6 ipython-5.8.0 ipython-genutils-0.2.0 pathlib2-2.3.3 pexpect-4.6.0 pickleshare-0.7.5 prompt-toolkit-1.0.15 ptyprocess-0.6.0 pygments-2.3.0 scandir-1.9.0 setuptools-40.6.3 simplegeneric-0.8.1 six-1.12.0 traitlets-4.3.2 wcwidth-0.1.7
[root@server01 work]# 
[root@server01 work]# ipython
Python 2.7.5 (default, Apr 11 2018, 07:36:10) 
Type "copyright", "credits" or "license" for more information.

IPython 5.8.0 -- An enhanced Interactive Python.
?         -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help      -> Python's own help system.
object?   -> Details about 'object', use 'object??' for extra details.

In [1]: exit
[root@server01 work]# 

标签:00,python,noarch,Centos7,pip,yum,ipython,packages
来源: https://www.cnblogs.com/xxllx/p/16339350.html