Linux install anaconda, Python, TensorFlow

Install anaconda

(1) Go to the official website to download the corresponding anaconda version: https://www.anaconda.com/download/#linux
(2) Use the bash command to install
Go to the download directory, and then the bash command:

bash Anaconda3-2020.07-Linux-x86_64.sh

(3) Configure environment variables
Open the .bashrc file:

vi ~/.bashrc
# 在.bashrc文件里面输入anconda的bin目录路径,如:
export PATH="/home/xxx/anaconda3/bin:$PATH"
#最后激活
source ~/.bashrc

(4) Check the installation

#查看anconda版本,验证是否安装成功。
conda --version

Install Python

Anaconda installs Python3 by default, if you need to install other versions, such as:
(1) View the currently installed Python environment

conda info -e   #列出当前安装的所有Python环境
python -V       #当前所处Python环境

(Base) indicates which python you are currently in

(2) Create environment

#创建一个名为python27的环境,指定Python版本是2.7(不用管是2.7.x,conda会为我们自动寻找2.7.x中的最新版本)
conda create --name python27 python=2.7

(3) View the environment

conda info -e

(4) Activate an environment

source activate python27

(5) Exit the environment

source deactivate python27

Install library

Check the current Python environment, switch back

#在当前环境下安装库函数
conda install XXX
pip install XXX

Install TensorFlow

Need to install tensorflow==1.15.4, use conda to install unsuccessfully, use pip
(1) pip install tensorflow==1.15.4report an error
(2) upgrade pip according to the prompts, and then reinstall TensorFlow, success~

Guess you like

Origin blog.csdn.net/qq_38879305/article/details/111682655