在linux系统上使用conda虚拟环境并安装tensorflow

1.安装conda

赋予sudo权限:sudo usermod -a -G sudo username

安装python:sudo apt install python3.8

安装conda:从Miniconda — conda documentation下载miniconda,

命令为:wget https://repo.anaconda.com/miniconda/Miniconda3-py38_4.12.0-Linux-x86_64.sh

安装conda:bash Miniconda3-py38_4.12.0-Linux-x86_64.sh

2.创建虚拟环境

这个例子是创建一个名称为tf 同时安装了python、tensorflow等工具的虚拟环境。

当然也可以只创建一个虚拟环境,后面再安装需要的库。

3.激活虚拟环境

命令:conda activate tf

如果上面的命令不行,可以试试这个:source activate tf

4.验证

激活环境之后,使用命令:ipython 进入python终端,然后操作如下:

就可以验证是否成功安装了tensorflow。 

猜你喜欢

转载自blog.csdn.net/hu_666666/article/details/127531850