Linux安装python3.6
一、安装python3.6 1. 安装依赖环境 # 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 2.下载Python3 https://www.python.org/downloads/ # wget https://www.python.org/ftp/python/3.6.1/Python-3.6.1.tgz 3.安装python3 在/usr/local/python3(具体安装位置看个人喜好) 创建目录: # mkdir -p /usr/local/python3 解压下载好的Python-3.x.x.tgz包(具体包名因你下载的Python具体版本不不同⽽而不不同,如:我下载的是Python3.6.1.那我这里就是Python-3.6.1.tgz) # tar -zxvf Python-3.6.1.tgz 4.进入解压后的目录,编译安装。 # cd Python-3.6.1 # ./configure --prefix=/usr/local/python3 # make make install make install 或者 make && make install 5.建立python3的软链 # ln -s /usr/local/python3/bin/python3 /usr/bin/python3 6.并将/usr/local/python3/bin加入PATH # vim ~/.bash_profile # .bash_profile # Get the aliases and functions if [ -f ~/.bashrc ]; then . ~/.bashrc fi # User specific environment and startup programs PATH=$PATH:$HOME/bin:/usr/local/python3/bin export PATH # source ~/.bash_profile 检查Python3及pip3是否正常可用: # python3 -V Python 3.6.1 # pip3 -V pip 9.0.1 from /usr/local/python3/lib/python3.6/site-packages (python 3.6) 7.不行的话在创建一下pip3的软链接 # ln -s /usr/local/python3/bin/pip3 /usr/bin/pip3
如果pip没有安装成功
install pip for python3.x
1.首先安装setuptools
wget --no-check-certificate https://pypi.python.org/packages/source/s/setuptools/setuptools-19.6.tar.gz#md5=c607dd118eae682c44ed146367a17e26 tar -zxvf setuptools-19.6.tar.gz cd setuptools-19.6.tar.gz python3 setup.py build python3 setup.py install
2.安装pip
wget --no-check-certificate https://pypi.python.org/packages/source/p/pip/pip-8.0.2.tar.gz#md5=3a73c4188f8dbad6a1e6f6d44d117eeb tar -zxvf pip-8.0.2.tar.gz cd pip-8.0.2 python3 setup.py build python3 setup.py install
3.创建软连接
I can feel you forgetting me。。
有一种默契叫做我不理你,你就不理我