Python3.x安装
一、PYTHON安装
1.安装或是升级Python3
下载地址:wget https://www.python.org/ftp/python/3.7.2/Python-3.7.2.tgz
学习注意事项:Python3与Python2互不兼容
[root@tansk ~]# mkdir -p /opt/python3 [root@tansk ~]# cd /opt/python3 [root@tansk python3]# yum install lrzsz-0.12.20-36.el7.x86_64 -y [root@tansk python3]# chmod 755 Python-3.7.2.tgz [root@tansk python3]# tar -zxvf Python-3.7.2.tgz [root@tansk python3]# cd Python-3.7.2/ [root@tansk Python-3.7.2]# yum -y install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite sqlite-devel readline-devel tk tk-devel gdbm gdbm-devel db4-devel libpcap-devel lzma xz xz-devel libuuid-devel libffi-devel [root@tansk Python-3.7.2]# vim Modules/Setup.dist 去掉注释: zlib zlibmodule.c -I$(prefix)/include -L$(exec_prefix)/lib -lz [root@tansk Python-3.7.2]# ./configure --prefix=/usr/local/python3.7.2
编译报错如下:
解决该问题的两种方法:
方法一:使用libressl代替OpenSSL
安装LibreSSL代替OpenSSL
下载地址:https://ftp.openbsd.org/pub/OpenBSD/LibreSSL/libressl-2.7.4.tar.gz
方法二:升级OpenSSL #本次实验使用方法
下载地址: http://www.openssl.org/source/openssl-1.0.2.tar.gz
tar -zxvf openssl-1.0.2.tar.gz cd openssl-1.0.2/ ./config --prefix=/usr/local/openssl make -j 8 make install mv /usr/bin/openssl /usr/bin/openssl.old mv /usr/include/openssl /usr/include/openssl.old ln -s /usr/local/openssl/bin/openssl /usr/bin/openssl ln -s /usr/local/openssl/include/openssl/ /usr/include/openssl echo "/usr/local/openssl/lib">>/etc/ld.so.conf openssl version -a
[root@tansk ~]# cd /opt/python3/Python-3.7.2 [root@tansk Python-3.7.2]# rm -rf Makefile [root@tansk Python-3.7.2]# ./configure --prefix=/usr/local/python3.7.2 [root@tansk Python-3.7.2]# make -j 8 [root@tansk Python-3.7.2]# make install [root@tansk ~]# ln -s /usr/local/python3.7.2/bin/python3 /usr/bin/python3 [root@tansk ~]# ln -s /usr/local/python3.7.2/bin/pip3 /usr/bin/pip3 [root@tansk ~]# python3 Python 3.7.2 (default, May 8 2020, 21:49:18) [GCC 4.8.5 20150623 (Red Hat 4.8.5-39)] on linux Type "help", "copyright", "credits" or "license" for more information. >>>
2.sublime编辑器
下载地址:http://www.sublimetext.com/3
CentOS7(图形化系统)安装过程:
cd /opt/ unzip sublime_text_3.zip chmod 755 -R sublime_text_3/* cp sublime_text_3/sublime_text.desktop /usr/share/applications/sublime_text.desktop ln -s /opt/sublime_text_3/sublime_text /usr/bin/sublime [root@localhost ~]# cat /usr/share/applications/sublime_text.desktop [Desktop Entry] Version=1.0 Type=Application Name=Sublime Text GenericName=Text Editor Comment=Sophisticated text editor for code, markup and prose Exec=/opt/sublime_text_3/sublime_text %F Terminal=false MimeType=text/plain; Icon=/opt/sublime_text_3/Icon/256x256/sublime-text.png Categories=TextEditor;Development; StartupNotify=true Actions=Window;Document; [Desktop Action Window] Name=New Window Exec=/opt/sublime_text_3/sublime_text -n OnlyShowIn=Unity; [Desktop Action Document] Name=New File Exec=/opt/sublime_text_3/sublime_text --command new_file OnlyShowIn=Unity; [root@localhost ~]# [root@localhost ~]# export DISPLAY=192.168.1.3:0.0 [root@localhost ~]# sublime