轻量级云服务器环境搭建
1.jupyter notebook库的下载
pip3 install jupyterlab jupyter_contrib.nbextensions
可能会报错
cloud-init 20.1 requires jsonpatch, which is not installed.
cloud-init 20.1 requires oauthlib, which is not installed.
解决:
pip3 install jsonpatch
pip3 install oauthlib
2.创建jupyter notebook连接
设置密码
~/.local/bin/jupyter-notebook password
创建环境
mkdir workspace
~/.local/bin/jupyter-notebook --no-browser --ip=0.0.0.0 ./workspace
在网页中输入 公网IP:8888就可用
腾讯云GPU服务器tensorflow环境搭建
GPU环境(tensorflow)
wget https://gpu-related-scripts-1251783334.cos.ap-guangzhou.myqcloud.com/gpu-auto-install/gpu_auto_install.sh && wget https://gpu-related-scripts-1251783334.cos.ap-guangzhou.myqcloud.com/gpu-auto-install/driver460_cuda11.2.2.txt && sudo bash ./gpu_auto_install.sh install --config_file=./driver460_cuda11.2.2.txt && source /etc/bash.bashrc && source ${HOME}/.bashrc
设置端口
入站规则和出站规则都要设置
来源:ALL 协议端口:TCP:8888 (一般)
来源:ALL 协议端口:TCP:8889 (先下了CPU版本,再下GPU版本会出现这样的情况)
打开Jupyter Notebook
jupyter-notebook
其中就会看见remote url,其中token不变,该前面的为公网ip就可以了
例如:http://118.195.185.83:8888/?token=0b3959a7b2ad7fb63e269f5e897443c986d89cefa34247e0
不想每次用token就使用
jupyter-notebook password
设置密码
数据集的上传
在jupyter-notebook中,右上角有一个上传按钮,对于数据集需要打包成.zip或.rar文件
对于.zip文件可以直接在Jupyter notebook中用python解压
import zipfile #导入zipfile模块(zipfile为python内置库)
###默认只读模式打开r
myzip = zipfile.ZipFile('test.zip')
###返回文件名
print(myzip.filename)
###返回文件列表
print(myzip.namelist())
对于.rar文件,找到jupyter-notebook对应的文件夹
一般在主目录下的./notebook中
下载unbuntu的rar解压命令:
sudo apt install rar
sudo apt install unrar
执行解压
sudo unrar x name.rar
额外包的下载
一般在ubuntu环境中用pip都能解决,最好是先下好了再打开jupyter-notebook
AutoDL服务器配置
基础配置
在自带的jupyterlab中打开终端,并进行初始化
sudo apt update
sudo apt upgrade
不然下不了包。