tensorflow pytorch环境安装

1.查看cuda版本(无关)

wlsh@wlsh-thinkstation-p920:~$ nvcc -V
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2019 NVIDIA Corporation
Built on Wed_Apr_24_19:10:27_PDT_2019
Cuda compilation tools, release 10.1, V10.1.168

wlsh@wlsh-thinkstation-p920:~$ cat /usr/local/cuda/version.txt
CUDA Version 10.1.168
wlsh
@wlsh-thinkstation-p920:~$ cat /usr/local/cuda/include/cudnn.h | grep CUDNN_MAJOR -A 2
cat: /usr/local/cuda/include/cudnn.h: No such
file or directory

 

2.安装anaconda虚拟环境

wlsh@wlsh-thinkstation-p920:~$ conda create -n py3_torch python=3.6 
wlsh
@wlsh-thinkstation-p920:~$ conda activate py3_torch
(py3_torch) wlsh
@wlsh-thinkstation-p920:~$

 

3.安装opencv

(py3_torch) wlsh@wlsh-thinkstation-p920:~$ conda install opencv

 

4.安装pytorch和torchvision

https://pytorch.org

 

(py3_torch) wlsh@wlsh-thinkstation-p920:~$ conda install pytorch torchvision cudatoolkit=10.0 -c pytorch

 

5.安装tensorflow和tensorboardX

https://www.zhihu.com/people/arsliv/posts

(py3_torch) wlsh@wlsh-thinkstation-p920:~$ conda install tensorflow-gpu
(py3_torch) wlsh
@wlsh-thinkstation-p920:~$ pip install tensorboardX

 

6.jupyter notebook关联此虚拟环境

(py3_torch) wlsh@wlsh-thinkstation-p920:~$ conda install nb_conda

 

7.端口重定向

本地mac连接远程服务器jupter notebook方法

https://www.digitalocean.com/community/tutorials/how-to-install-run-connect-to-jupyter-notebook-on-remote-server

[wlsh@wlsh-MacbookPro] ~$ ssh -L 8000:localhost:8888 wlsh@10.19.127.168
(base) wlsh
@wlsh-ThinkStation-P920:~$ jupyter notebook
http://localhost:8000

本地mac连接远程服务器可视化tensorboardX

参考:https://blog.csdn.net/weixin_35653315/article/details/71327740

#连接ssh时,将远程服务器的6006端口重定向到Mac
[wlsh@wlsh-MacbookPro] ~$ ssh -L 16006:127.0.0.1:6006 wlsh@10.19.127.168
#使用6006端口启动tensorboard
(base) wlsh@wlsh-thinkstation-p920:~/Desktop/wlsh/MyTestCode$ tensorboard --logdir=./log --port=6006
#Mac浏览器输入地址
127.0.0.1:16006

8.本地pycharm使用远程服务器的python解释器,并编辑服务器的代码

Configure a remote interpterter using SSH : https://www.jetbrains.com/help/pycharm/configuring-remote-interpreters-via-ssh.html

Pycharm - > Preferences

 

Creating a Remote Server Configuration:  https://www.jetbrains.com/help/pycharm/creating-a-remote-server-configuration.html

Tools - > Deployment

 

9.解决加载外面的py文件不成功方法:

https://stackoverflow.com/questions/1907993/autoreload-of-modules-in-ipython

%load_ext autoreload
%autoreload 2

 

10.cell输出多行

from IPython.core.interactiveshell import InteractiveShell
InteractiveShell.ast_node_interactivity =
"all"

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值