在Mac上安装Tensorflow的问题 [英] Issues installing Tensorflow on mac

查看:100
本文介绍了在Mac上安装Tensorflow的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在按照tensorflow网站上的说明使用 virtualenv 进行安装并出现以下问题在python交互式shell中使用import tensorflow as tf验证安装时. 请注意,我正在运行 Python 3.7

I am following instructions from tensorflow website using virtualenv to install and having following issue when validating installation using import tensorflow as tf in python interactive shell. Please note, I am running Python 3.7

这是我已安装的软件包的列表.

Here are list of packages I have installed.

有人可以帮忙吗?

我还尝试删除

I also tried to remove protobuf suggested by stackoverflow issue using pip uninstall protobuf, but doesn't help.

推荐答案

经过一些研究,我能够解决上述问题.看起来,tensorflow与我在计算机上安装的 python 3.7 (截至7月30日)不兼容. 跟随 github问题帮助我解决了该问题.

I was able to resolve above issue after some research. It looks like, tensorflow is not compatible with python 3.7 (as of July 30th 18) which is what I had installed on my computer . Following github issue helped me resolved the issue.

我使用pyenv安装了python 3.6.6 ,并设置了virtualenv.这是我所做的:

I installed python 3.6.6 using pyenv and setup virtualenv. Here is what I did:

# Install python 3.3.6 and create virtualenv    
$ pyenv install 3.6.6
    $ pyenv virtualenv 3.6.6 tensorflow_image_recognition_3_6_6
    $ pyenv activate tensorflow_image_recognition_3_6_6

# update pip
    $ easy_install -U pip

#Install tensorflow
    $ pip3 install --upgrade tensorflow

# Test if tensorflow is installed properly
    # open python interactive shell
    $ python 
    import tensorflow as tf
    hello = tf.constant('Hello, TensorFlow!')
    sess = tf.Session()
    print(sess.run(hello))

这篇关于在Mac上安装Tensorflow的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆