安装Python软件包 1.官网下载压缩包 2.压缩包进行解压
[root@server ~]# tar zxf Python-3.6.4.tgz [root@server ~]# ls anaconda-ks.cfg Documents Music Public Python-3.6.4.tgz Videos Desktop Downloads Pictures Python-3.6.4 Templates3.解决安装的依赖性
[root@server ~]# cd Python-3.6.4 [root@server Python-3.6.4]# ls aclocal.m4 Doc LICENSE Objects pyconfig.h.in config.guess Grammar Mac Parser Python config.sub Include Makefile.pre.in PC README.rst configure install-sh Misc PCbuild setup.py configure.ac Lib Modules Programs Tools [root@server Python-3.6.4]# yum install gcc zlib zlib-devel openssl-devel -y ##解决依赖性4.安装
[root@server Python-3.6.4]# ./configure --prefix=/usr/local/python3 --with-ssl ##--prefix 指定安装路径 --with-ssl 添加ssl加密 [root@server Python-3.6.4]# make && make install ##进行安装 [root@server Python-3.6.4]# cd /usr/local/python3 [root@server python3]# ls bin include lib share [root@server python3]# cd bin/ [root@server bin]# ls python3出现则安装成功 2to3 idle3.6 pydoc3.6 python3.6m pyvenv-3.6 2to3-3.6 pip3 python3 python3.6m-config easy_install-3.6 pip3.6 python3.6 python3-config idle3 pydoc3 python3.6-config pyvenv5.测试是否安装成功
[root@server bin]# /usr/local/python3/bin/python3 ## Python 3.6.4 (default, May 23 2019, 15:45:30) [GCC 4.8.2 20140120 (Red Hat 4.8.2-16)] on linux Type "help", "copyright", "credits" or "license" for more information. >>> print('hello') hello >>>Ctrl+D退出命令执行 6.添加python3的命令到环境变量中 (1)临时添加
[root@server bin]# export PATH="/usr/local/python3/bin:$PATH" [root@server bin]# python3 Python 3.6.4 (default, May 23 2019, 15:45:30) [GCC 4.8.2 20140120 (Red Hat 4.8.2-16)] on linux Type "help", "copyright", "credits" or "license" for more information. >>>(2)永久添加
[root@server bin]# echo export PATH="/usr/local/python3/bin:$PATH" >> /root/.bashrc [root@server bin]# source /root/.bashrc [root@server bin]# python3 Python 3.6.4 (default, May 23 2019, 15:45:30) [GCC 4.8.2 20140120 (Red Hat 4.8.2-16)] on linux Type "help", "copyright", "credits" or "license" for more information. >>>7.将python3安装包导入真机以供实验使用
[root@server bin]# scp -r /usr/local/python3 root@172.25.4.250:/usr/local真机测试是否可以成功运行
[kiosk@foundation4 ~]$ cd /usr/local [kiosk@foundation4 local]$ ls bin etc games include lib lib64 libexec python3 sbin share src [kiosk@foundation4 local]$ cd python3 [kiosk@foundation4 python3]$ ls bin include lib share [kiosk@foundation4 python3]$ cd bin [kiosk@foundation4 bin]$ ls 2to3 idle3.6 pydoc3.6 python3.6m pyvenv-3.6 2to3-3.6 pip3 python3 python3.6m-config easy_install-3.6 pip3.6 python3.6 python3-config idle3 pydoc3 python3.6-config pyvenv [kiosk@foundation4 bin]$ /usr/local/python3/bin/python3 Python 3.6.4 (default, May 23 2019, 15:45:30) [GCC 4.8.2 20140120 (Red Hat 4.8.2-16)] on linux Type "help", "copyright", "credits" or "license" for more information. >>> print('hello') hello二.pycharm编译器的安装
[root@foundation4 kiosk]# ls Deskto Documents passwd pycharm-community-2016.3.2.tar.gz desktop Downloads Pictures Templates Desktop Music Public Videos [root@foundation4 kiosk]# tar zxf pycharm-community-2016.3.2.tar.gz ##解压压缩包 [root@foundation4 kiosk]# ls Deskto Documents passwd pycharm-community-2016.3.2 Videos desktop Downloads Pictures pycharm-community-2016.3.2.tar.gz Desktop Music Public Templates [root@foundation4 kiosk]# cd pycharm-community-2016.3.2 [root@foundation4 pycharm-community-2016.3.2]# ls bin help Install-Linux-tar.txt lib plugins build.txt helpers jre license [root@foundation4 pycharm-community-2016.3.2]# cd bin [root@foundation4 bin]# ls format.sh idea.properties pycharm64.vmoptions restart.py fsnotifier inspect.sh pycharm.png fsnotifier64 log.xml pycharm.sh fsnotifier-arm printenv.py pycharm.vmoptions [root@foundation4 bin]# sh pycharm.sh ##运行脚本设置里面的内容,进入工具进行设置File–Setting