为了装tensorflow,阅览过无数的帖子,发现以下这个帖子可用:
https://blog.csdn.net/yandajiangjun/article/details/102615912
仔细按照以上博客操作,基本成功实现tensorflow的安装。如下:
但是呢,当你打开spyder,在console敲入 import tensorflow as tf时,会出现以下错误:
import tensorflow as tf
Traceback (most recent call last):
File "C:\Users\lixun\anaconda3\lib\site-packages\IPython\core\interactiveshell.py", line 3331, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File "<ipython-input-1-64156d691fe5>", line 1, in <module>
import tensorflow as tf
File "C:\Users\lixun\anaconda3\lib\site-packages\tensorflow\__init__.py", line 22, in <module>
from tensorflow.python import pywrap_tensorflow # pylint: disable=unused-import
File "C:\Users\lixun\anaconda3\lib\site-packages\tensorflow\python\__init__.py", line 49, in <module>
from tensorflow.python import pywrap_tensorflow
File "C:\Users\lixun\anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "C:\Users\lixun\anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 114
def TFE_ContextOptionsSetAsync(arg1, async):
^
SyntaxError: invalid syntax
百思不得其解!以下是解决办法:
打开anaconda navigator,将applications的channel调为tensorflow,并install spyder. 最后launch spyder.
在新的spyder中,就可以键入 import tensorflow as tf.
成功了有木有