Linux之安装python3.6.6
1.先下载源码包:wget https://www.python.org/ftp/python/3.6.6/Python-3.6.6.tgz 将源码包下载到 usr/soft路径下 2.下载python3编译的依赖包:yum install -y gcc patch libffi-devel zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel xz-devel 3.解压:tar -zxvf Python-3.6.6.tgz 4.进入解压后的Python3.6.6文件下:cd Python-3.6.6 ./configure --prefix=/usr/local/python3 5.编译:相当于把源码包里面的代码编译成linux服务器可以识别的代码 make 6.编译安装:make install 7.查看pip版本:pip3 -V 8.更改linux的path变量,添加python3: 1)编辑环境变量:vim /etc/profile 2)修改路径:path=/usr/local/python3/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin 注意:将python放在最前面 3)重载配置文件:source /etc/profile 4)查看path:echo $path 9.进入python3:python3
|