描述一下我的问题:
由于我以前用的是CUDA10.0,然后GPU只能用tf2.0.0版本的,后来在网上看到兼容,所以换了版本。
所以现在:
1.我的环境是 anaconda+win10+pycharm。
2.我装的CUDA是10.2,CUDA10.2兼容CUDA10.1和10.0,且那个关键的dll文件已经复制粘贴改名字了。然后我创建了虚拟环境tf23和tf20;在虚拟环境tf23里面安装的是TensorFlow-gpu 2.3.0,并且在cmd命令行终端中成功import使用;在虚拟环境tf20里面安装的是TensorFlow-gpu 2.0.0,并且在cmd命令行终端中成功import使用。
3.我在pycharm中创建项目,使用的是TensorFlow-gpu 2.0.0版本,然后得到了这个报错:
OSError: [WinError 126] 找不到指定的模块。
- 我去百度过了这个问题的解决方法,解决方法说是下载vc++ 2015.09那个C++链接库组件,但是下载之后提示我本身已经安装有其他版本的链接库了。如果我安装2015.09版本的话会不会影响到我TensorFlow-gpu 2.3.0在pycharm中的使用呢?
5.在命令行终端中能使用,但是在pycharm中却无法使用,这是什么回事呢?我应该如何解决这个问题呢?
该报错的控制台输出如下:
import tensorflow as tf
File "C:\Users\chenruhai\anaconda3\envs\tf20\lib\site-packages\tensorflow\__init__.py", line 98, in <module>
from tensorflow_core import *
File "C:\Users\chenruhai\anaconda3\envs\tf20\lib\site-packages\tensorflow_core\__init__.py", line 40, in <module>
from tensorflow.python.tools import module_util as _module_util
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 959, in _find_and_load_unlocked
File "C:\Users\chenruhai\anaconda3\envs\tf20\lib\site-packages\tensorflow\__init__.py", line 50, in __getattr__
module = self._load()
File "C:\Users\chenruhai\anaconda3\envs\tf20\lib\site-packages\tensorflow\__init__.py", line 44, in _load
module = _importlib.import_module(self.__name__)
File "C:\Users\chenruhai\anaconda3\envs\tf20\lib\importlib\__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "C:\Users\chenruhai\anaconda3\envs\tf20\lib\site-packages\tensorflow_core\python\__init__.py", line 83, in <module>
from tensorflow.python import keras
File "C:\Users\chenruhai\anaconda3\envs\tf20\lib\site-packages\tensorflow_core\python\keras\__init__.py", line 26, in <module>
from tensorflow.python.keras import activations
File "C:\Users\chenruhai\anaconda3\envs\tf20\lib\site-packages\tensorflow_core\python\keras\__init__.py", line 26, in <module>
from tensorflow.python.keras import activations
File "C:\Users\chenruhai\anaconda3\envs\tf20\lib\site-packages\tensorflow_core\python\keras\activations.py", line 23, in <module>
from tensorflow.python.keras.utils.generic_utils import deserialize_keras_object
File "C:\Users\chenruhai\anaconda3\envs\tf20\lib\site-packages\tensorflow_core\python\keras\utils\__init__.py", line 38, in <module>
from tensorflow.python.keras.utils.multi_gpu_utils import multi_gpu_model
File "C:\Users\chenruhai\anaconda3\envs\tf20\lib\site-packages\tensorflow_core\python\keras\utils\multi_gpu_utils.py", line 22, in <module>
from tensorflow.python.keras.engine.training import Model
File "C:\Users\chenruhai\anaconda3\envs\tf20\lib\site-packages\tensorflow_core\python\keras\engine\training.py", line 47, in <module>
from tensorflow.python.keras.engine import training_arrays
File "C:\Users\chenruhai\anaconda3\envs\tf20\lib\site-packages\tensorflow_core\python\keras\engine\training_arrays.py", line 41, in <module>
from scipy.sparse import issparse # pylint: disable=g-import-not-at-top
File "C:\Users\chenruhai\anaconda3\envs\tf20\lib\site-packages\scipy\__init__.py", line 136, in <module>
from . import _distributor_init
File "C:\Users\chenruhai\anaconda3\envs\tf20\lib\site-packages\scipy\_distributor_init.py", line 59, in <module>
WinDLL(os.path.abspath(filename))
File "C:\Users\chenruhai\anaconda3\envs\tf20\lib\ctypes\__init__.py", line 364, in __init__
self._handle = _dlopen(self._name, mode)
OSError: [WinError 126] 找不到指定的模块。
进程已结束,退出代码为 1