安装TensorFlow的prettytensor不能在OSX上运行

时间:2016-04-08 03:08:43

标签: python install pip tensorflow prettytensor

我无法安装prettytensor。我已尝试通过pip以及安装源代码并在目录中执行python setup.py install

我更新了tensorflow。有没有人知道如何在我的机器上安装prettytensor

pip install prettytensor
Requirement already satisfied (use --upgrade to upgrade): prettytensor in ./anaconda/lib/python2.7/site-packages/prettytensor-0.6.0-py2.7.egg
Requirement already satisfied (use --upgrade to upgrade): enum34>=1.0.0 in ./anaconda/lib/python2.7/site-packages (from prettytensor)
Requirement already satisfied (use --upgrade to upgrade): six>=1.10.0 in ./anaconda/lib/python2.7/site-packages (from prettytensor)
Collecting tensorflow>=0.7.1 (from prettytensor)
  Could not find a version that satisfies the requirement tensorflow>=0.7.1 (from prettytensor) (from versions: )
No matching distribution found for tensorflow>=0.7.1 (from prettytensor)

当我尝试导入prettytensor

Python 2.7.11 |Anaconda 2.3.0 (x86_64)| (default, Dec  6 2015, 18:57:58) 
[GCC 4.2.1 (Apple Inc. build 5577)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
Anaconda is brought to you by Continuum Analytics.
Please check out: http://continuum.io/thanks and https://anaconda.org
>>> import tensorflow as tf
>>> import prettytensor as pt
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/Mu/anaconda/lib/python2.7/site-packages/prettytensor-0.6.0-py2.7.egg/prettytensor/__init__.py", line 25, in <module>
    from prettytensor import funcs
  File "/Users/Mu/anaconda/lib/python2.7/site-packages/prettytensor-0.6.0-py2.7.egg/prettytensor/funcs.py", line 25, in <module>
    from prettytensor.pretty_tensor_image_methods import *
  File "/Users/Mu/anaconda/lib/python2.7/site-packages/prettytensor-0.6.0-py2.7.egg/prettytensor/pretty_tensor_image_methods.py", line 20, in <module>
    from prettytensor import layers
ImportError: cannot import name layers

1 个答案:

答案 0 :(得分:3)

请检查tensorflow的版本。

如果你的张量流不是0.7.1,你可以升级如下。

(另见https://www.tensorflow.org/versions/r0.7/get_started/os_setup.html

# Mac OSX, CPU only:
$ pip install --upgrade https://storage.googleapis.com/tensorflow/mac/tensorflow-0.7.1-cp27-none-any.whl

然后再次安装prettytensor。

$ pip uninstall prettytensor
$ pip install prettytensor

供您参考。 这是我的结果。(OSX 10.11.3)

In [1]: import tensorflow as tf

In [2]: tf.__version__
Out[2]: '0.7.1'

In [3]: import prettytensor as pt

In [4]: pt.PrettyTensor
Out[4]: prettytensor.pretty_tensor_class.PrettyTensor