tensorflow import issue for python 3.7

≡放荡痞女 提交于 2019-12-20 05:11:33

问题


After installing tensorflow for python 3.7, I tried to import it but it gave me a syntax error. the command used for installation : sudo -H pip3 install --upgrade https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-1.10.0-py3-none-any.whl

I don't think tensorflow has supported python3.7 yet. Is there a way to fix it?

enter image description here


回答1:


You can solve this by simply changing the name of all these (Ctrl + R and Replace All) from async to for example async1 as also this post suggests.

But even after fixing it you will probably encounter other problems with Tensorflow and Python 3.7.0 . For more details see my answer here: Does TensorFlow 1.9 support Python 3.7




回答2:


tensorflow import for python 3.7 for Anaconda 2019.03 with Python 3.7 version

for CPU

create command:

conda create -n tensorflow_env tensorflow

activate command:

conda activate tensorflow_env

Import command:

(tensorflow_env) C:\WINDOWS\system32>python

import tensorflow as tf

print(tf.version)

for GPU

create command:

conda create -n tensorflow_gpuenv tensorflow-gpu

activate command:

conda activate tensorflow_gpuenv

Import command:

(tensorflow_gpuenv) C:\WINDOWS\system32>python

import tensorflow as tf

print(tf.version)



来源:https://stackoverflow.com/questions/51780304/tensorflow-import-issue-for-python-3-7

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!