我无法安装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
最佳答案
请检查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
关于python - 为TensorFlow安装prettytensor在OSX上不起作用,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/36490849/