当前位置:   article > 正文

ModuleNotFoundError: No module named ‘pycuda._driver‘ python3.7_modulenotfounderror: no module named 'pycuda

modulenotfounderror: no module named 'pycuda
#bug
ModuleNotFoundError: No module named 'pycuda._driver'
  • 1
  • 2

原因是系统同时安装了python3.7和python3.8, 当python3.8为默认的python3时,安装pycuda是对于python3.8版本

import pycuda.autoinit
import pycuda.driver as cuda
  • 1
  • 2

就会报标题的错误.

卸载python3.8(tensorrt7.0.0只支持到python3.7)

sudo apt-get remove python3.8
sudo apt-get remove --auto-remove python3.8
sudo apt-get purge python3.8

rm -rf /usr/bin/python3
# 将python3链接到python3.7
ln -s /usr/bin/python3.7 /usr/bin/python3

# 重新安装pycuda
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple pycuda --no-binary :all:
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/盐析白兔/article/detail/129860
推荐阅读
相关标签
  

闽ICP备14008679号