查看conda环境:conda env listpython
新建conda环境(env_name就是建立的环境名,能够自定义):conda create -n env_namenginx
激活conda环境(ubuntu与Macos 将conda 替换为source):conda activate env_namejson
退出conda环境:conda deactivateubuntu
安装和卸载python包:conda install numpy # conda uninstall numpyspa
查看已安装python列表:conda list -n env_namecode
例如:blog
conda create -n TF_2C python=3.7接口
conda activate TF_2Cip
下载地址rem
https://mirrors.tuna.tsinghua.edu.cn/anaconda/miniconda/
conda install notebook ipykernel
jupyter notebook 启动
jupyter notebook --no-browser --port 8888 --ip=0.0.0.0
l 生成一个 notebook 配置文件
默认状况下,配置文件 ~/.jupyter/jupyter_notebook_config.py 并不存在,须要自行建立。使用下列命令生成配置文件:
jupyter notebook --generate-config
l 生成密码
自动生成
从 jupyter notebook 5.0 版本开始,提供了一个命令来设置密码:jupyter notebook password,生成的密码存储在 jupyter_notebook_config.json。
$ jupyter notebook password
Enter password: ****
Verify password: ****
l 修改配置文件
在 jupyter_notebook_config.py 中找到下面的行,取消注释并修改。
c.NotebookApp.ip='*' #在全部的网卡接口上开启服务
c.NotebookApp.port =8888 #可自行指定一个端口, 访问时使用该端口1234
c.NotebookApp.allow_remote_access = True #容许远程
TF2.0
conda activate TF_2C
pip install tensorflow==2.0.0 -i https://pypi.tuna.tsinghua.edu.cn/simple
import tensorflow as tf version = tf.__version__ gpu_ok = tf.test.is_gpu_available print("tf version:",version,"\n use GPU",gpu_ok)