1.安装python
一、压缩包安装
1.安装依赖包和编译环境
yum install openssldevel zlibdevel bzip2devel expatdevel gdbmdevel tk-devel tcldevel readlinedevel sqlitedevel libX11devel libX11 tkinter gcc gcc c++ y
2.创建软件安装目录,最好是空的 ,以免文件混乱
mkdir /usr/local/python3
3.编译参数
tar zxf Python-3.7.0.tgz cd Python-3.7.0/ ./configure --prefix=/usr/local/python3 --enable-optimizations && make && make install
二、yum安装python
yum -y install python3
1.改为国内源
mkdir ~/.pip vim ~/.pip/pip.conf 写入数据 [global] index-url = http://pypi.douban.com/simple [install] trusted-host = pypi.douban.com
三、.安装ipython
pip3 install ipython
四、基础使用
创建虚拟环境
python3 -m venv /opt/py3
进入虚拟环境
source ./py3/bin/activate
退出虚拟环境
deactivate