Cài đặt Tensorflow


#1

Các anh chị cho em hỏi, em đang cài đặt Tensorflow trên máy tính nhưng gặp lỗi này:

ImportError Traceback (most recent call last) c:\users\admin\appdata\local\programs\python\python37\lib\site-packages\tensorflow\python\pywrap_tensorflow.py in 57 —> 58 from tensorflow.python.pywrap_tensorflow_internal import * 59

c:\users\admin\appdata\local\programs\python\python37\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py in 27 return _mod —> 28 _pywrap_tensorflow_internal = swig_import_helper() 29 del swig_import_helper

c:\users\admin\appdata\local\programs\python\python37\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py in swig_import_helper() 23 try: —> 24 _mod = imp.load_module(’_pywrap_tensorflow_internal’, fp, pathname, description) 25 finally:

c:\users\admin\appdata\local\programs\python\python37\lib\imp.py in load_module(name, file, filename, details) 241 else: –> 242 return load_dynamic(name, filename, file) 243 elif type_ == PKG_DIRECTORY:

c:\users\admin\appdata\local\programs\python\python37\lib\imp.py in load_dynamic(name, path, file) 341 name=name, loader=loader, origin=path) –> 342 return _load(spec) 343

ImportError: DLL load failed: A dynamic link library (DLL) initialization routine failed.

During handling of the above exception, another exception occurred:

ImportError Traceback (most recent call last) in ----> 1 import tensorflow as tf

c:\users\admin\appdata\local\programs\python\python37\lib\site-packages\tensorflow_init_.py in 39 import sys as _sys 40 —> 41 from tensorflow.python.tools import module_util as _module_util 42 from tensorflow.python.util.lazy_loader import LazyLoader as _LazyLoader 43

c:\users\admin\appdata\local\programs\python\python37\lib\site-packages\tensorflow\python_init_.py in 48 import numpy as np 49 —> 50 from tensorflow.python import pywrap_tensorflow 51 52 # Protocol buffers

c:\users\admin\appdata\local\programs\python\python37\lib\site-packages\tensorflow\python\pywrap_tensorflow.py in 67 for some common reasons and solutions. Include the entire stack trace 68 above this error message when asking for help.""" % traceback.format_exc() —> 69 raise ImportError(msg) 70 71 # pylint: enable=wildcard-import,g-import-not-at-top,unused-import,line-too-long

ImportError: Traceback (most recent call last): File “c:\users\admin\appdata\local\programs\python\python37\lib\site-packages\tensorflow\python\pywrap_tensorflow.py”, line 58, in from tensorflow.python.pywrap_tensorflow_internal import * File “c:\users\admin\appdata\local\programs\python\python37\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py”, line 28, in _pywrap_tensorflow_internal = swig_import_helper() File “c:\users\admin\appdata\local\programs\python\python37\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py”, line 24, in swig_import_helper _mod = imp.load_module(’_pywrap_tensorflow_internal’, fp, pathname, description) File “c:\users\admin\appdata\local\programs\python\python37\lib\imp.py”, line 242, in load_module return load_dynamic(name, filename, file) File “c:\users\admin\appdata\local\programs\python\python37\lib\imp.py”, line 342, in load_dynamic return _load(spec) ImportError: DLL load failed: A dynamic link library (DLL) initialization routine failed.

Failed to load the native TensorFlow runtime.

See https://www.tensorflow.org/install/errors

for some common reasons and solutions. Include the entire stack trace above this error message when asking for help.


máy em: Window 10 HP Z800 tensorflow 2.2.0 cuda toolkit 10.1 cuDNN: 7.4.2

em cài bằng pip, pip install tensorflow anh chị giúp em với!


#2

Bạn cài thử bằng Anaconda xem sao.


#3

Mình là không muốn dùng anaconda vì có nhiều cái cũng chẳng dùng trong đó :slight_smile:


#4

Mình đã thử dùng conda để cài đặt nhưng sau đó chỉ dùng được trong anaconda prompt chứ không dùng được trong các IDE khác ?


#5

Vì mỗi thằng nó có một chỗ cài đặt khác nhau thì phải. Theo mình cách tốt nhất khi cài trên Windows là dùng WSL, không thì dùng Anaconda.