一、在pycharm上使用服务器的python环境
1.File->settings->python interpreter
2.点add->ssh interpreter 输入host(服务器地址),端口,username
3.输入密码
4.选择一个编译器。可以通过conda自建一个
5.本地项目的位置->服务器上面放项目的位置
二、设置同步代码
1.tool->deployment->configuration
2.测试连接
3.检查地址是否对,就是步骤一中设置的服务器上面放项目的位置。
4.设置同步代码
三、在服务器上安装依赖。
1.打开服务器终终端
2.创建一个anconda环境
conda create -n PyTorch python=3.8 conda activate PyTorch
3.安装依赖
找到存放项目的地方,就是步骤一中设置的服务器上面放项目的位置。
pip install -r .\requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple
四、选择python环境
选择刚刚配置的python环境,运行即可