简介
最近需要在阿里云上运行Python程序,而目前Linux自带的Python版本都为Python2.7,而我们的开发程序都是Python3。以前的做法是安装Python3,而yum以python2.7作为解释器,可能导致yum用不了,需要重新指定解释器,比较繁琐还容易出现一系列问题。这里选择安装Anaconda3,步骤简单无风险。
步骤
1、yum install -y bzip2
。需提前安装bzip2,否则出现如下错误:

2、安装Anaconda:
bash Anaconda3-2019.03-Linux-x86_64.sh
。一路回车,在需要输入yes/no的时候输入yes,即可完成安装。3、配置Python环境:
vim /etc/profile
#配置Anaconda
export PATH=/root/anaconda3/bin:$PATH
4、使配置生效:source /etc/profile
5、验证

网友评论