在linux里安装python3.6环境,linux环境下安装python3.6

66b52468c121889b900d4956032f1009.png

8种机械键盘轴体对比

本人程序员,要买一个写代码的键盘,请问红轴和茶轴怎么选?

一、 Linux下安装Python3.6和第三方库如果本机安装了python2,尽量不要管他,使用python3运行python脚本就好了,因为可能有进程依赖目前python2环境,比如yum!!!

不要动现有的python2环境!

二、 安装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# 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-3.6.1.tgz)# tar -zxvf Python-3.6.1.tgz

4.进入解压后的目录,编译安装。# cd Python-3.6.1

# ./configure --prefix=/usr/local/python3

make & make installmake

make install 或者 make && make install

5.建立python3的软链ln -s /usr/local/python3/bin/python3 /usr/bin/python3

6.并将/usr/local/python3/bin加入PATHvim ~/.bash_profile

.bash_profile

# Get the aliases and fundtions

if[ -f ~/.bashrc ]; then

. ~/.bashrc

fi

# User spcific environment and startup programs

PATH=$PATH:$HOME/bin:/usr/local/python3/bin

export PATH

按ESC,输入:wq 回车退出

修改完记得执行行下面的命令,让上一步的修改生效。source ~/.bash_profile

检查Python3及pip3是否正常可用:python3 -V

#Python 3.6.1

pip3 -V

#pip3 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

你可能感兴趣的:(在linux里安装python3.6环境,linux环境下安装python3.6)