一矩乐、pip 安裝
1、使用pip3安裝Tensorflow回论、jupyter lab
#更新pip源
pip install -i http://mirrors.aliyun.com/pypi/simple --trusted-host mirrors.aliyun.com --upgrade pip
#安裝TensorFlow2.2.0
pip install -i http://mirrors.aliyun.com/pypi/simple --trusted-host mirrors.aliyun.com tensorflow==2.2.0
#安裝jupyter lab作為交互式開發(fā)環(huán)境
pip install -i http://mirrors.aliyun.com/pypi/simple --trusted-host mirrors.aliyun.com jupyter lab
2散罕、jupyter lab 配置json文件---config.json
{
"NotebookApp": {
"ip":"*",
"port":8888,
"password":"",
"open_browser":false,
"token":"",
"allow_root":true
}
}
其中,密碼的生成方法如下
$ python
Python 3.7.3 (default, Mar 27 2019, 22:11:17)
[GCC 7.3.0] :: Anaconda, Inc. on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from notebook.auth import passwd
>>> passwd()
Enter password:
Verify password:
'sha1:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
生成后將該字符串填到上面的password中即可傀蓉。
3欧漱、jupyter lab啟動命令
jupyter lab --config config.json
二、Docker安裝
1葬燎、拉取鏡像并運行容器
docker run -itd \
-p 8888:8888 \
-v /opts/python-project:/python-project \
tensorflow/tensorflow:2.2.0-jupyter \
bash
2误甚、進入容器
docker exec -it <你的容器ID> bash
3、安裝jupyter lab
pip install -i http://mirrors.aliyun.com/pypi/simple --trusted-host mirrors.aliyun.com jupyterlab
4谱净、進入容器窑邦,啟動jupyter lab
jupyter lab --config config.json