3

我无法安装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
4

1 回答 1

3

请检查 tensorflow 的版本。

如果你的 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
于 2016-04-08T14:57:26.500 回答