赞
踩
自TensorFlow 2.12起,TensorFlow不再有专门的GPU版本,TensorFlow团队发布了一个Install TensorFlow with Pip的安装指南,在安装TensorFlow 12.0或以上版本之前,TensorFlow团队要求执行如下命令,但执行后却出现ModuleNotFoundError: No module named 'nvidia'的错误。这个问题目前在网上还没有解决办法。
Install TensorFlow with pip
https://www.tensorflow.org/install/pip
$ mkdir -p $CONDA_PREFIX/etc/conda/activate.d
$ echo 'CUDNN_PATH=$(dirname $(python -c "import nvidia.cudnn;print(nvidia.cudnn.__file__)"))' >> $CONDA_PREFIX/etc/conda/activate.d/env_vars.sh
$ echo 'export LD_LIBRARY_PATH=$CONDA_PREFIX/lib/:$CUDNN_PATH/lib:$LD_LIBRARY_PATH' >> $CONDA_PREFIX/etc/conda/activate.d/env_vars.sh
$ source $CONDA_PREFIX/etc/conda/activate.d/env_vars.sh
Traceback (most recent call last):
File "", line 1, in
ModuleNotFoundError: No module named 'nvidia'
dirname: missing operand
Try 'dirname --help' for more information.
另一种情况是在安装了TensorFlow 2.12或以上版本后只能识别CPU、不能识别GPU的情形,目前网上查到的一个TensorFlow论坛链接,仅供参考:
TensorFlow Installation Error - General Discussion - TensorFlow Forum
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。