Pycharm远程配置及Linux&Windows虚拟环境安装记录

在linux环境中使用virtualenv创建虚拟环境,这样就可以在不同,安装:pip install virtualenv;

创建文件夹用于存放虚拟环境,使用命令:virtualenv 环境名称如gpu_test,此时在当前路径下就创建了名为gpu_test的虚拟python环境,进入gpu_test/bin路径,里面有python执行文件。

执行命令:source activate,激活当前虚拟环境,使用deactivate退出当前环境。

如果是windows系统,则是在创建的虚拟环境目录中进入Scripts,执行activate.bat激活环境,执行deactivate.bat退出当前环境。

添加清华源:

conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
conda config --set show_channel_urls yes  # 显示镜像源
安装pytorch:conda install pytorch torchvision torchaudio cpuonly 

移除清华源:

conda config --remove channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/

注意:删除的时候最后要有反斜杠"/",否则报错“CondaKeyError: 'channels': 'https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/' is not in the 'channels' key of the config file”

Linux 查看NVIDIA版本:nvidia-smi,cuda版本:nvcc -V

安装 pytorch官网命令:

conda install pytorch torchvision torchaudio pytorch-cuda=11.7 -c pytorch -c nvidia

使用外部源,去掉-c pytorch:

conda install pytorch torchvision torchaudio pytorch-cuda=11.7 -c nvidia

参考:

Python使用virtualenv创建虚拟环境的详细步骤_python_脚本之家 (jb51.net)

python学习笔记-Pycharm远程连接服务器的Python虚拟环境(Virtualenv) - 乱石之渐 - 博客园 (cnblogs.com)

(2023)CUDA11.7+Python3.9+Pytorch GPU安装_cuda11.7对应的pytorch-CSDN博客

conda | 设置软件源_conda 腾讯源-CSDN博客

anaconda | 镜像站使用帮助 | 清华大学开源软件镜像站 | Tsinghua Open Source Mirror

使用conda创建Python的虚拟环境(包括linux环境下)_conda创建python虚拟环境-CSDN博客

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值