【日常学习】使用anaconda管理环境并安装cuda和cudnn和tensorflow

目录

 

安装anaconda

管理环境

安装cuda 9.0和cudnn7


安装anaconda

Ubuntu 20.04安装Anaconda3+配置+使用jupyter notebook_阿清~的博客-CSDN博客

从官网下载安装包 https://www.anaconda.com/products/individual

页面最下方找到Linux版本,选择第一个下载。注意python3.8

 bash Anaconda3-2020.02-Linux-x86_64.sh

Old package lists — Anaconda documentation

查看不同Python版本的anaconda版本号

安装完成后,在终端输入

python3

查看python版本:


如果出现上图显示的“Anaconda”,说明配置成功,否则需要重新配置环境变量。

重新配置环境

gedit ~/.bashrc

 或者vim打开 vim ~/.bashrc

打开文件后,在最后一行添加语句:

export PATH="home/zhangwenjun/anaconda3/bin:$PATH"
这里的路径选择是你的Anaconda的默认安装路径,默认在home下。
点击保存,关闭bashrc文件,最后一定要在终端输入下面命令才能生效:

source ~/.bashrc

再次python3 就出现了anaconda

管理环境

Anaconda管理你乱七八糟的环境_嘿芝麻的树洞-CSDN博客

conda activate之后就可以随心所欲啦~

1 创建并激活一个环境:conda create --name env_name python=python版本号 -y。
简写为 conda create -n env_name python=python版本号 -y,

如:conda create -n open-mmlab python=3.7 -y。
其中python=python版本号可以省略,默认为当前 python 版本。

2 列出所有的环境:conda info --envs。
简写为 conda info -e,其中,当前所在环境被标记*。

3 进入某个环境:source activateenv_name,如source activate mmlab

4 验证当前环境是否切换成功:conda info -e

5 退出当前环境(返回原始环境):source deactivate

6 复制一个环境:conda create -n env_name1 --clone env_name。复制env_name环境为env_name1。
7 删除一个环境:conda remove -n env_name --all

安装cuda 9.0和cudnn7

ubuntu16.04 通过anaconda建立虚拟环境,安装cuda9.0,cudnn7.1.2_陌若安生的博客-CSDN博客

安装tensorflow指定版本用conda install搜不到,使用pip安装:

解决anaconda pip无法使用指定环境下的pip安装_GXLiu-CSDN博客

import tensorflow的时候又出现一堆乱七八糟的东西

/home/zhangwenjun/anaconda3/envs/oneshot/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:517: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_qint8 = np.dtype([("qint8", np.int8, 1)])
/home/zhangwenjun/anaconda3/envs/oneshot/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:518: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_quint8 = np.dtype([("quint8", np.uint8, 1)])
/home/zhangwenjun/anaconda3/envs/oneshot/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:519: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_qint16 = np.dtype([("qint16", np.int16, 1)])
/home/zhangwenjun/anaconda3/envs/oneshot/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:520: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_quint16 = np.dtype([("quint16", np.uint16, 1)])
/home/zhangwenjun/anaconda3/envs/oneshot/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:521: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_qint32 = np.dtype([("qint32", np.int32, 1)])
/home/zhangwenjun/anaconda3/envs/oneshot/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:526: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  np_resource = np.dtype([("resource", np.ubyte, 1)])

按照这个帖子改了就好了

/home/image/.conda/envs/tensorflow/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py_Vertira的博客-CSDN博客

Guess you like

Origin blog.csdn.net/Drinks_/article/details/119825601