我在Jupyter Notebook中运行Keras模型,并尝试在第二个JN中导入Tensorflow,但收到一条奇怪的消息,该消息已在命令提示符下复制:
(tf2) C:\WINDOWS\system32>python
Python 3.7.4 (default, Aug 9 2019, 18:34:13) [MSC v.1915 64 bit (AMD64)] :: Anaconda, Inc. on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import tensorflow
2019-11-01 13:19:19.434547: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cudart64_100.dll
ModuleNotFoundError: No module named 'numpy.core._multiarray_umath'
ImportError: numpy.core.multiarray failed to import
ImportError: numpy.core._multiarray_umath failed to import
ImportError: numpy.core.umath failed to import
2019-11-01 13:19:19.819614: F tensorflow/python/lib/core/bfloat16.cc:675] Check failed: PyBfloat16_Type.tp_base != nullptr
我无法理解的是,我可以在一个JN中运行Keras模型,却无法在命令提示符或另一个JN中导入Tensorflow。
(tf2) C:\WINDOWS\system32>python
Python 3.7.4 (default, Aug 9 2019, 18:34:13) [MSC v.1915 64 bit (AMD64)] :: Anaconda, Inc. on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> print(sys.path)
['', 'C:\\Users\\Alienware\\Anaconda3\\envs\\tf2\\python37.zip', 'C:\\Users\\Alienware\\Anaconda3\\envs\\tf2\\DLLs', 'C:\\Users\\Alienware\\Anaconda3\\envs\\tf2\\lib', 'C:\\Users\\Alienware\\Anaconda3\\envs\\tf2', 'C:\\Users\\Alienware\\Anaconda3\\envs\\tf2\\lib\\site-packages', 'C:\\Users\\Alienware\\Anaconda3\\envs\\tf2\\lib\\site-packages\\win32', 'C:\\Users\\Alienware\\Anaconda3\\envs\\tf2\\lib\\site-packages\\win32\\lib', 'C:\\Users\\Alienware\\Anaconda3\\envs\\tf2\\lib\\site-packages\\Pythonwin']