1.pycharm里直接在代码中加入下面

import os
os.environ["CUDA_VISIBLE_DEVICES"] = "2"

2.在终端指定使用

CUDA_VISIBLE_DEVICES=2 python xxx.py

内容源自:https://www.cnblogs.com/darkknightzh/p/6836568.html

相关文章:

  • 2021-09-24
  • 2021-11-25
  • 2021-09-10
  • 2022-12-23
  • 2022-01-02
  • 2022-12-23
  • 2021-05-09
猜你喜欢
  • 2022-01-01
  • 2022-12-23
  • 2021-11-30
  • 2021-07-25
  • 2021-11-28
  • 2022-12-23
  • 2021-04-07
相关资源
相似解决方案