我正在尝试在Anaconda环境中安装tensorflow。由于我正在运行许多现有环境,因此我必须绑定到Miniconda2,并且不想迁移到Miniconda3。
我知道how to install tensorflow on anaconda python 3.6
到目前为止,我所做的是:
conda create -n tf pip python=3.6
activate tf
然后我尝试了
conda install -c intel tensorflow
当我尝试跑步时
import tensorflow as tf
hello = tf.constant('Hello, TensorFlow!')
sess = tf.Session()
print(sess.run(hello))
我遇到错误
File "C:\temp\2018-11-03 DL Segmentation\hello world.py", line 1, in <module>
import tensorflow as tf
File "c:\Users\Thomas\Miniconda2\envs\tf\Lib\site-packages\tensorflow\__init__.py", line 22, in <module>
from tensorflow.python import pywrap_tensorflow # pylint: disable=unused-import
File "c:\Users\Thomas\Miniconda2\envs\tf\Lib\site-packages\tensorflow\python\__init__.py", line 49, in <module>
from tensorflow.python import pywrap_tensorflow
File "c:\Users\Thomas\Miniconda2\envs\tf\Lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 74, in <module>
raise ImportError(msg)
builtins.ImportError: Traceback (most recent call last):
File "c:\Users\Thomas\Miniconda2\envs\tf\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 14, in swig_import_helper
return importlib.import_module(mname)
File "c:\Users\Thomas\Miniconda2\envs\tf\lib\importlib\__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 994, in _gcd_import
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 658, in _load_unlocked
File "<frozen importlib._bootstrap>", line 571, in module_from_spec
我已按照此处的建议安装了Microsoft C ++ dll,但未成功: https://github.com/tensorflow/tensorflow/issues/6055
备注:我也尝试了以下方法但没有成功:
pip install --ignore-installed --upgrade https://storage.googleapis.com/tensorflow/windows/cpu/tensorflow-1.11.0-cp36-cp36m-win_amd64.whl
有什么想法吗?
更新:
我在装有Miniconda3环境而不是Miniconda2的另一台PC上尝试了相同的方法,并且hello world程序起作用了:
conda install -c intel tensorflow
张量流与Miniconda2不兼容吗?