简体   繁体   中英

I have an error while importing tensorflow

I'm using Python 3.6.0 and I downloaded tensorflow using pip install tensorflow , I tried several times to uninstall tensorflow and install another version of tensorflow but it didn't work... Which version of tensorflow is compatible for me? (I'm using now version 1.15.0)

This is the import error:

Traceback (most recent call last):
  File "C:\Users\User\PycharmProjects\pythonProject1\venv\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 64, in <module>
    from tensorflow.python._pywrap_tensorflow_internal import *
ImportError: DLL load failed: A dynamic link library (DLL) initialization routine failed.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\User\Desktop\adsp\train.py", line 1, in <module>
    import tensorflow as tf
  File "C:\Users\User\PycharmProjects\pythonProject1\venv\lib\site-packages\tensorflow\__init__.py", line 41, in <module>
    from tensorflow.python.tools import module_util as _module_util
  File "C:\Users\User\PycharmProjects\pythonProject1\venv\lib\site-packages\tensorflow\python\__init__.py", line 39, in <module>
    from tensorflow.python import pywrap_tensorflow as _pywrap_tensorflow
  File "C:\Users\User\PycharmProjects\pythonProject1\venv\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 83, in <module>
    raise ImportError(msg)
ImportError: Traceback (most recent call last):
  File "C:\Users\User\PycharmProjects\pythonProject1\venv\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 64, in <module>
    from tensorflow.python._pywrap_tensorflow_internal import *
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.

You need to install the C++ redist libraries C++

c++ redist lib

you could use anaconda, it is super easy. 1) Install anaconda individual edition, 2) Open Anaconda Navigator 3) Create a new environment called tf. (choose python 3.7) 4) Still on the UI, install tensorfolow on your tf environment. It takes a minute and always works.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM