centos7 python3.7+vi

centos7 python3.7+vim8

Install python3.7
https://www.python.org/downloads/

https://www.python.org/downloads/release/python-372/

wget https://www.python.org/ftp/python/3.7.2/Python-3.7.2.tgz

Install Python3.7.2

Install Python required dependencies
yum -y install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel libffi-devel python-devel

Unzip tar
tar -xvzf Python-3.7.2.tgz
Configuration
cd Python3.7.2
make clean
. /configure --prefix=/usr/local/python3.7
make
make install
Delete old version python link
rm /usr/bin/python
ln -s /usr/local/python3.7/bin/python3.7 /usr/bin/python
Check if the installation is successful
python -V
Note: centos7 default python 2.7.5
For example: /usr/bin/firewall-cmd, /usr/bin/yum uses python2, please modify it to #!/usr/bin/python2

Install vim8.1

Source package download:
https://github.com/vim/vim

Download vim8.1:
https://github.com/vim/vim/archive/v8.1.0888.tar.gz
wget https://github.com/vim/vim/archive/v8.1.0888.tar.gz
Uninstall old version
yum remove vim*
Unzip tar
tar -xzvf v8.1.0888.tar.gz
cd vim-8.1.0888

Find the python3 configuration file path
Note: If you are using Python, your config directory may have a computer-specific name (such as config-3.5m-x86_64-linux-gnu) Find the path to the ptyhonn.o file
Because the YouCompleteMe plug-in will be installed later, the YCM plug-in requires vim to support python2, so both python2 and python3 are configured here.
. /configure --with-features=huge \

installation
make
make install
Create link
ln -s /usr/local/vim/bin/vim /usr/bin/vim
vim ~/.bashrc
alias vi='vim'

Configure vim environment to support python3
Vundle is a plugin management tool for Vim
mkdir -p ~/.vim/bundle
git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim

Add plugin
Note: between call vundle#begin()......call vundle#end(), open vim insert mode: PluginInstall

vim ~/.vimrc
" Vundle
" Remove VI consistency
set nocompatible
filetype off
" Set the running path of Vundle
set rtp+=~/.vim/bundle/Vundle.vim
" Set the installation path of the plug-in, the start flag of the vundle plug-in
call vundle#begin()
" Let vundle manage the plugin version
Plugin 'VundleVim/Vundle.vim'
" Set the installation path of the plugin, vundle plugin end flag
call vundle#end()
" Load the syntax and file type related scripts that come with vim and plug-ins
filetype plugin indent on

set encoding=utf-8 "Set utf-8 encoding
set number "display line number
syntax on "Turn on syntax highlighting
set background=dark "Set the background color
set showmatch "Display matched parentheses
set backspace=2 "You can delete any value
set scrolloff=5 "5 lines from the top and bottom
set laststatus=2 "The command line is two lines
set fenc=utf-8 "file encoding

" Python
set filetype=python
au BufNewFile,BufRead .py,.pyw setf python
set autoindent "Set auto indent
set smartindent "Automatically indent the next line
set textwidth=79 "Maximum line width
set expandtab "tab is replaced with a space bar
set tabstop=4 "Set table length
set softtabstop=4 "The width of softtabstop is 4
set shiftwidth=4 "Set the number of spaces for indentation to 4
set fileformat=unix "Set to save the file in unix format
set foldmethod=indent "Automatic folding
set foldlevel=79 "Up to 79 characters

" F5 direct debugging in vim
map :call RunPython()
func! RunPython()
exec "w"
if &filetype =='python' "The first line#!/bin/python Run the python compiler
exec "!time python %"
elseif &filetype =='sh' "The first line #!/bin/bash Run the shell compiler
:! time bash %
endif
endfunc

Recommended Posts

centos7 python3.7+vi
CentOS 8 (2)
CentOS 8 (1)
CentOS + Python3.6+
CentOS + Jenkins
1.5 Install Centos7
2019-07-09 CentOS7 installation
centos7_1708 installation
Centos 7.5 python3.6
Centos5 installation guide
Centos6 install Python2.7.13
Centos basic commands
Centos7.3 install nginx
CentOS7.2 install Mysql5.7.13
CentOS install Redmine
Centos7 install Python 3.6.
CentOS7 install MySQL
Centos7 install protobuf
CentOS 7 install Docker
CentOS7.0 network configuration
CentOS 7.0 network configuration
CentOS 8 officially released
CentOS 7 deploy OpenLDAP+FreeRadius
CentOS 7.4 install Zabbix 3.4
CentOS7 install Docker
Centos6.5 install Tomcat
CentOS install Python 3.6
Vmware install CentOS6
centos7 install docker-ce 18.01.0
CentOS 7.2 install MariaDB
CentOS 7 install Hadoop 3.0.0
Python - centos6 installation
Centos7 install Python2.7
CentOS6.5 network settings
Centos 7.6 install seleniu
CentOS 8 officially released
CentOS7 basic configuration
CentOS 7.3 install Zabbix3
Centos7 install LAMP+PHPmyadmin
centos system management
CentOS install mysql
CentOS7 build jenkins
Docker installation (CentOS7 installation)
Centos6.5 openssh upgrade
Centos build lnmp
Centos7 build python3.8.5+scrapy+gerapy
CentOS install openjdk 1.8
CENTOS6.5 install CDH5.12.1 (1)
CentOS install PHP
CentOS mirror types
CentOS6 install mist.io
Centos7 install Docker
CentOS7 install mysql
centOs install rabbitMQ
CentOS 7 install MySQL 5.6
CentOS 6/7 update curl
Centos7 install Nginx
CentOS6.5 install CDH5.13
Centos7 install docker18
Centos install Python3
centos7 install docker