1、安装conda
2、conda info -e 查看已经存在的conda的虚拟环境
3、conda create -n your_env_name python=x.x 创建虚拟环境
4、成功后,pip install 报名 安装需要的包,出错的话,看一下下面的
5、source activate your_env_nam 激活虚拟环境就行
RuntimeError: CUDA error: no kernel image is available for execution on the device CUDA kernel errors might be asynchronously reported at some other API call,so the stacktrace below might be incorrect. For debugging consider passing CUDA_LAUNCH_BLOCKING=1.
解答1:
1.检查python中 pytorch版本
python import torch torch.__version__() #1.10.2+cuda102
2、升级python到3.8(conda install python==3.8)升级方法如下,然后,从新按照环境就可以解决问题
pip安装是出现错误Could not fetch URL https://pypi.tuna.tsinghua.edu.cn/simple/pipenv/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.tuna.tsinghua.edu.cn', port=443): Max retries exceeded with url: /simple/pipenv/
解决方案:
可用源
豆瓣:http://pypi.douban.com/simple/
清华:https://pypi.tuna.tsinghua.edu.cn/simple
清华大学的pip源,它是官网pypi的镜像,每隔5分钟同步一次,推荐使用
sudo pip install pandas -i https://pypi.tuna.tsinghua.edu.cn/simple/ --trusted-host pypi.tuna.tsinghua.edu.cnanaconda虚拟环境中,python版本升级失败
使用pip install python=3.8失败
解决方案
使用conda安装,conda install python==3.8既可,然后之前安装的比如pandas等第三方包都会自动卸载,在升级成功之后需要重新下载对应的包
AssertionError: Torch not compiled with CUDA enabled
原因是安装了pytorch的cpu版本,如果要使用cuda需要按照gou版本的pytorch,命令行conda install pytorch-gpu
命令不要写错了哦,如果写错了比如我 conda install pytorch-gpu
ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts. 翻译:pip的依赖项解析器当前未考虑安装的所有包。此行为是以下依赖项冲突的根源 pysptk 0.1.20 requires decorator, which is not installed. pysptk 0.1.20 requires scipy, which is not installed. nnmnkwii 0.1.1 requires scikit-learn, which is not installed. nnmnkwii 0.1.1 requires scipy, which is not installed. nnmnkwii 0.1.1 requires tqdm, which is not installed.
当前期安装的包是使用conda install 安装的,后面使用pip install 安装时会出现这个问题,因为conda安装时会检查之前安装的所有包,而pip不会,这样就会很容易导致冲突,所以需要切换到conda install 重新安装



