首页 » 软件优化 » 老韩说Python01-构建Python开发环境(安装软件包验证运行事务)

老韩说Python01-构建Python开发环境(安装软件包验证运行事务)

萌界大人物 2024-11-30 17:51:19 0

扫一扫用手机浏览

文章目录 [+]

[root@kafkazk1 ~]# yum list python36上次元数据过期检查:0:33:29 前,执行于 2020年12月27日 星期日 19时49分39秒。
已安装的软件包python36.x86_64 3.6.8-2.module_el8.1.0+245+c39af44f @AppStream可安装的软件包python36.x86_64 3.6.8-2.module_el8.3.0+562+e162826a AppStream [root@kafkazk1 ~]# yum list python38上次元数据过期检查:0:33:33 前,执行于 2020年12月27日 星期日 19时49分39秒。
可安装的软件包python38.x86_64 3.8.3-3.module_el8.3.0+468+0c52a667 AppStream

2.安装Python38

[root@kafkazk1 ~]# yum -y install python38上次元数据过期检查:0:33:48 前,执行于 2020年12月27日 星期日 19时49分39秒。
依赖关系解决。
===================================================================================================================================== 软件包 架构 版本 仓库 大小=====================================================================================================================================Installing: python38 x86_64 3.8.3-3.module_el8.3.0+468+0c52a667 AppStream 78 k安装依赖关系: python38-libs x86_64 3.8.3-3.module_el8.3.0+468+0c52a667 AppStream 8.3 M python38-pip-wheel noarch 19.3.1-1.module_el8.3.0+441+3b561464 AppStream 1.2 M python38-setuptools-wheel noarch 41.6.0-4.module_el8.3.0+441+3b561464 AppStream 304 k安装弱的依赖: python38-pip noarch 19.3.1-1.module_el8.3.0+441+3b561464 AppStream 1.9 M python38-setuptools noarch 41.6.0-4.module_el8.3.0+441+3b561464 AppStream 667 kEnabling module streams: python38 3.8 事务概要=====================================================================================================================================安装 6 软件包总下载:12 M安装大小:45 M下载软件包:(1/6): python38-3.8.3-3.module_el8.3.0+468+0c52a667.x86_64.rpm 24 kB/s | 78 kB 00:03 (2/6): python38-pip-19.3.1-1.module_el8.3.0+441+3b561464.noarch.rpm 180 kB/s | 1.9 MB 00:10 (3/6): python38-pip-wheel-19.3.1-1.module_el8.3.0+441+3b561464.noarch.rpm 161 kB/s | 1.2 MB 00:07 (4/6): python38-setuptools-41.6.0-4.module_el8.3.0+441+3b561464.noarch.rpm 1.1 MB/s | 667 kB 00:00 (5/6): python38-setuptools-wheel-41.6.0-4.module_el8.3.0+441+3b561464.noarch.rpm 735 kB/s | 304 kB 00:00 (6/6): python38-libs-3.8.3-3.module_el8.3.0+468+0c52a667.x86_64.rpm 478 kB/s | 8.3 MB 00:17 -------------------------------------------------------------------------------------------------------------------------------------总计 713 kB/s | 12 MB 00:17 运行事务检查事务检查成功。
运行事务测试事务测试成功。
运行事务 准备中 : 1/1 Installing : python38-setuptools-wheel-41.6.0-4.module_el8.3.0+441+3b561464.noarch 1/6 Installing : python38-pip-wheel-19.3.1-1.module_el8.3.0+441+3b561464.noarch 2/6 Installing : python38-libs-3.8.3-3.module_el8.3.0+468+0c52a667.x86_64 3/6 Installing : python38-3.8.3-3.module_el8.3.0+468+0c52a667.x86_64 4/6 运行脚本 : python38-3.8.3-3.module_el8.3.0+468+0c52a667.x86_64 4/6 Installing : python38-setuptools-41.6.0-4.module_el8.3.0+441+3b561464.noarch 5/6 运行脚本 : python38-setuptools-41.6.0-4.module_el8.3.0+441+3b561464.noarch 5/6 Installing : python38-pip-19.3.1-1.module_el8.3.0+441+3b561464.noarch 6/6 运行脚本 : python38-pip-19.3.1-1.module_el8.3.0+441+3b561464.noarch 6/6 验证 : python38-3.8.3-3.module_el8.3.0+468+0c52a667.x86_64 1/6 验证 : python38-libs-3.8.3-3.module_el8.3.0+468+0c52a667.x86_64 2/6 验证 : python38-pip-19.3.1-1.module_el8.3.0+441+3b561464.noarch 3/6 验证 : python38-pip-wheel-19.3.1-1.module_el8.3.0+441+3b561464.noarch 4/6 验证 : python38-setuptools-41.6.0-4.module_el8.3.0+441+3b561464.noarch 5/6 验证 : python38-setuptools-wheel-41.6.0-4.module_el8.3.0+441+3b561464.noarch 6/6 已安装: python38-3.8.3-3.module_el8.3.0+468+0c52a667.x86_64 python38-pip-19.3.1-1.module_el8.3.0+441+3b561464.noarch python38-setuptools-41.6.0-4.module_el8.3.0+441+3b561464.noarch python38-libs-3.8.3-3.module_el8.3.0+468+0c52a667.x86_64 python38-pip-wheel-19.3.1-1.module_el8.3.0+441+3b561464.noarch python38-setuptools-wheel-41.6.0-4.module_el8.3.0+441+3b561464.noarch 完毕!

3.验证Python3.8是否安装成功

老韩说Python01-构建Python开发环境(安装软件包验证运行事务) 软件优化
(图片来自网络侵删)

[root@kafkazk1 ~]# python3.8 Python 3.8.3 (default, Aug 31 2020, 16:03:14) [GCC 8.3.1 20191121 (Red Hat 8.3.1-5)] on linuxType "help", "copyright", "credits" or "license" for more information.>>> print("跟老韩学Python")跟老韩学Python>>> [root@kafkazk1 ~]#

4.安装pip3.6

[root@kafkazk1 ~]# pippip-3 pip3 pip-3.6 pip3.6 [root@kafkazk1 ~]# pip3 install ipythonWARNING: Running pip install with root privileges is generally not a good idea. Try `pip3 install --user` instead.Collecting ipython Downloading https://files.pythonhosted.org/packages/23/6a/210816c943c9aeeb29e4e18a298f14bf0e118fe222a23e13bfcc2d41b0a4/ipython-7.16.1-py3-none-any.whl (785kB) 100% |████████████████████████████████| 788kB 267kB/s Collecting jedi>=0.10 (from ipython) Downloading https://files.pythonhosted.org/packages/f9/36/7aa67ae2663025b49e8426ead0bad983fee1b73f472536e9790655da0277/jedi-0.18.0-py2.py3-none-any.whl (1.4MB) 100% |████████████████████████████████| 1.4MB 251kB/s Requirement already satisfied: decorator in /usr/lib/python3.6/site-packages (from ipython)Collecting traitlets>=4.2 (from ipython) Downloading https://files.pythonhosted.org/packages/ca/ab/872a23e29cec3cf2594af7e857f18b687ad21039c1f9b922fac5b9b142d5/traitlets-4.3.3-py2.py3-none-any.whl (75kB) 100% |████████████████████████████████| 81kB 490kB/s Collecting pexpect; sys_platform != "win32" (from ipython) Downloading https://files.pythonhosted.org/packages/39/7b/88dbb785881c28a102619d46423cb853b46dbccc70d3ac362d99773a78ce/pexpect-4.8.0-py2.py3-none-any.whl (59kB) 100% |████████████████████████████████| 61kB 850kB/s Collecting backcall (from ipython) Downloading https://files.pythonhosted.org/packages/4c/1c/ff6546b6c12603d8dd1070aa3c3d273ad4c07f5771689a7b69a550e8c951/backcall-0.2.0-py2.py3-none-any.whlRequirement already satisfied: setuptools>=18.5 in /usr/lib/python3.6/site-packages (from ipython)Collecting prompt-toolkit!=3.0.0,!=3.0.1,<3.1.0,>=2.0.0 (from ipython) Downloading https://files.pythonhosted.org/packages/8a/aa/198e6a857e83ea8b711a6ae0c37717c0eb1b23ff52e3732a644fcd389cb3/prompt_toolkit-3.0.8-py3-none-any.whl (355kB) 100% |████████████████████████████████| 358kB 486kB/s Collecting pickleshare (from ipython) Downloading https://files.pythonhosted.org/packages/9a/41/220f49aaea88bc6fa6cba8d05ecf24676326156c23b991e80b3f2fc24c77/pickleshare-0.7.5-py2.py3-none-any.whlCollecting pygments (from ipython) Downloading https://files.pythonhosted.org/packages/85/c5/c437c383d5917fae9782eb6588bec8aff931afe13c76b9e8c03dacee9beb/Pygments-2.7.3-py3-none-any.whl (950kB) 100% |████████████████████████████████| 952kB 247kB/s Collecting parso<0.9.0,>=0.8.0 (from jedi>=0.10->ipython) Downloading https://files.pythonhosted.org/packages/ad/f0/ef6bdb1eba2dbfda60c985cd8d7b47b6ed8c6a1f5d212f39ff50b64f172c/parso-0.8.1-py2.py3-none-any.whl (93kB) 100% |████████████████████████████████| 102kB 467kB/s 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.whlRequirement already satisfied: six in /usr/lib/python3.6/site-packages (from traitlets>=4.2->ipython)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.whlCollecting wcwidth (from prompt-toolkit!=3.0.0,!=3.0.1,<3.1.0,>=2.0.0->ipython) Downloading https://files.pythonhosted.org/packages/59/7c/e39aca596badaf1b78e8f547c807b04dae603a433d3e7a7e04d67f2ef3e5/wcwidth-0.2.5-py2.py3-none-any.whlInstalling collected packages: parso, jedi, ipython-genutils, traitlets, ptyprocess, pexpect, backcall, wcwidth, prompt-toolkit, pickleshare, pygments, ipythonSuccessfully installed backcall-0.2.0 ipython-7.16.1 ipython-genutils-0.2.0 jedi-0.18.0 parso-0.8.1 pexpect-4.8.0 pickleshare-0.7.5 prompt-toolkit-3.0.8 ptyprocess-0.6.0 pygments-2.7.3 traitlets-4.3.3 wcwidth-0.2.5[root@kafkazk1 ~]# ipython --version7.16.1

5.安装pip3.8

[root@kafkazk1 ~]# pippip-3 pip3 pip-3.6 pip3.6 pip-3.8 pip3.8 [root@kafkazk1 ~]# pip3.8 install ipythonWARNING: Running pip install with root privileges is generally not a good idea. Try `pip3.8 install --user` instead.Collecting ipython Downloading https://files.pythonhosted.org/packages/e0/c7/1c91a71b413c82cd4c49fb8b6676f6135650cd2cca2745a96bd84a56166c/ipython-7.19.0-py3-none-any.whl (784kB) |????????????????????????????????| 788kB 364kB/s Requirement already satisfied: setuptools>=18.5 in /usr/lib/python3.8/site-packages (from ipython) (41.6.0)Collecting prompt-toolkit!=3.0.0,!=3.0.1,<3.1.0,>=2.0.0 Using cached https://files.pythonhosted.org/packages/8a/aa/198e6a857e83ea8b711a6ae0c37717c0eb1b23ff52e3732a644fcd389cb3/prompt_toolkit-3.0.8-py3-none-any.whlCollecting pickleshare Using cached https://files.pythonhosted.org/packages/9a/41/220f49aaea88bc6fa6cba8d05ecf24676326156c23b991e80b3f2fc24c77/pickleshare-0.7.5-py2.py3-none-any.whlCollecting pygments Using cached https://files.pythonhosted.org/packages/85/c5/c437c383d5917fae9782eb6588bec8aff931afe13c76b9e8c03dacee9beb/Pygments-2.7.3-py3-none-any.whlCollecting pexpect>4.3; sys_platform != "win32" Using cached https://files.pythonhosted.org/packages/39/7b/88dbb785881c28a102619d46423cb853b46dbccc70d3ac362d99773a78ce/pexpect-4.8.0-py2.py3-none-any.whlCollecting backcall Using cached https://files.pythonhosted.org/packages/4c/1c/ff6546b6c12603d8dd1070aa3c3d273ad4c07f5771689a7b69a550e8c951/backcall-0.2.0-py2.py3-none-any.whlCollecting jedi>=0.10 Using cached https://files.pythonhosted.org/packages/f9/36/7aa67ae2663025b49e8426ead0bad983fee1b73f472536e9790655da0277/jedi-0.18.0-py2.py3-none-any.whlCollecting traitlets>=4.2 Downloading https://files.pythonhosted.org/packages/f6/7d/3ecb0ebd0ce8dcdfa7bd47ab85c1d4a521e6770ef283d0824f5804994dfe/traitlets-5.0.5-py3-none-any.whl (100kB) |????????????????????????????????| 102kB 577kB/s Collecting decorator Downloading https://files.pythonhosted.org/packages/ed/1b/72a1821152d07cf1d8b6fce298aeb06a7eb90f4d6d41acec9861e7cc6df0/decorator-4.4.2-py2.py3-none-any.whlCollecting wcwidth Using cached https://files.pythonhosted.org/packages/59/7c/e39aca596badaf1b78e8f547c807b04dae603a433d3e7a7e04d67f2ef3e5/wcwidth-0.2.5-py2.py3-none-any.whlCollecting ptyprocess>=0.5 Using cached https://files.pythonhosted.org/packages/d1/29/605c2cc68a9992d18dada28206eeada56ea4bd07a239669da41674648b6f/ptyprocess-0.6.0-py2.py3-none-any.whlCollecting parso<0.9.0,>=0.8.0 Using cached https://files.pythonhosted.org/packages/ad/f0/ef6bdb1eba2dbfda60c985cd8d7b47b6ed8c6a1f5d212f39ff50b64f172c/parso-0.8.1-py2.py3-none-any.whlCollecting ipython-genutils Using cached https://files.pythonhosted.org/packages/fa/bc/9bd3b5c2b4774d5f33b2d544f1460be9df7df2fe42f352135381c347c69a/ipython_genutils-0.2.0-py2.py3-none-any.whlInstalling collected packages: wcwidth, prompt-toolkit, pickleshare, pygments, ptyprocess, pexpect, backcall, parso, jedi, ipython-genutils, traitlets, decorator, ipythonSuccessfully installed backcall-0.2.0 decorator-4.4.2 ipython-7.19.0 ipython-genutils-0.2.0 jedi-0.18.0 parso-0.8.1 pexpect-4.8.0 pickleshare-0.7.5 prompt-toolkit-3.0.8 ptyprocess-0.6.0 pygments-2.7.3 traitlets-5.0.5 wcwidth-0.2.5

6.输入一些简单的Python测试语句

[root@kafkazk1 ~]# ipython3Python 3.8.3 (default, Aug 31 2020, 16:03:14) Type 'copyright', 'credits' or 'license' for more informationIPython 7.19.0 -- An enhanced Interactive Python. Type '?' for help.In [1]: num1 = 1 + 1In [2]: num1Out[2]: 2In [3]: num1 += 4In [4]: num1Out[4]: 6In [5]: print("跟老韩学Python")跟老韩学PythonIn [6]: exit()

7.ipython会有颜色显示,如下图所示。

ipython3终端环境的代码有颜色显示

好了,跟老韩学Python系列第1次课到这里就结束了,请小伙伴们多多指点,有问题一起探讨。

标签:

相关文章