conda

查看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/

 

Jupyter環境

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)
相關文章
相關標籤/搜索