- 连接服务器之后检查系统版本
root@6f65f3f5d148 ~# getconf LONG_BIT
2. 在设定的目录下下载anaconda安装包(使用清华镜像源)
root@6f65f3f5d148 ~/u/pytorch# wget https://mirrors.tuna.tsinghua.edu.cn/anaconda/archive/Anaconda3-2021.11-Linux-x86_64.sh
开始安装
3. 在安装的目录下执行
bash Anaconda3-2021.11-Linux-x86_64.sh
在license的时候输入yes
4.环境配置
Anaconda3 will now be installed into this location:
/root/anaconda3
- Press ENTER to confirm the location
- Press CTRL-C to abort the installation
- Or specify a different location below
[/root/anaconda3] >>>
默认路径直接回车,需要改路径输入绝对路径
在这里我犯了修改路径的错误
然后怎么改 profile 和 ~/.bashrc中的路径都没有用
始终输入conda和pip就会报错
报bad interpreter 和no such file or directory
都已经快要放弃了看怎么重装,但是绝处逢生,这个链接的方法有用
原文链接
真的这么多文件一个个去改然后才好的
劝大家一定要慎重改路径。。。
其中该路径的过程中还遇到过
Found a swap file by the name “ect/.profile.swp”
的问题,解决办法
- 激活Conda环境
报错
CommandNotFoundError: Your shell has not been properly configured to use 'conda activate'.
解决办法:还是用source
source activate
- 安装pytorch
在官网选择相应版本的指令
我选择了我的
conda install pytorch torchvision torchaudio cudatoolkit=10.2 -c pytorch
7. 安装Jupyter
安装插件
pip install jupyter_contrib_nbextensions -i https://pypi.douban.com/simple
jupyter contrib nbextensiion install --user
root@6f65f3f5d148 ~# ipython
In [1]: from notebook.auth import passwd
In [2]: passwd()
Enter password:
Verify password:
秘钥保存
argon2:$argon2id$v=19$m=10240,t=10,p=8$3q72iixaXIUuUy1UNrFJAw$AoxwuXQBOCBrhPvx97mwpQ
- 修改配置文件
root@6f65f3f5d148 ~# vim /root/.jupyter/jupyter_notebook_config.py
#改几个地方:
c.NotebookApp.ip = 'xx.xxx.xx.xxx' 即对外提供访问的ip
c.NotebookApp.port = 5555 即对外提供访问的端口
c.NotebookApp.open_browser = False False即启动不打开浏览器
c.NotebookApp.password = u'argon2:$argon2id$v=19$m=10240,t=10,p=8$dNoC/suYvnQ3+2wdq2SGpw$bZNkHCGYqg/JrTQRZsXaQA' 这个就是上面生成的秘钥
c.NotebookApp.notebook_dir = u'/root' 即设置jupyter启动后默认的根目录
- 启动
jupyter notebook --allow-root
打开网页用IP:端口打开即可