安装 python3-dev、 python3-pip、virtualenv
sudo apt update
sudo apt install python3-dev python3-pip
sudo pip3 install -U virtualenv # system-wide install
创建虚拟环境
virtualenv --system-site-packages -p python3 ./venv
激活虚拟环境
source ./venv/bin/activate
安装tensorflow
pip3 install --upgrade tensorflow
验证
python -c "import tensorflow as tf; tf.enable_eager_execution(); print(tf.reduce_sum(tf.random_normal([1000, 1000])))"
安装其他库
pip3 install numpy matplotlib sklearn pandas jupyter
设置Notebook远程访问
1、生成 ~/.jupyter/jupyter_notebook_config.py
jupyter notebook --generate-config
在 jupyter_notebook_config.py 中找到下面的行,取消注释并修改。
2、在 jupyter_notebook_config.py 中添加
c.NotebookApp.ip='*'
c.NotebookApp.open_browser = False
c.NotebookApp.port =8888
c.NotebookApp.allow_remote_access = True