[英]Failed to run Python script with Conda
I tried to install menpo like in this tutorial . 我尝试在本教程中安装menpo。 After that I installed menpofit, menpo3d and menpodetect:
之后我安装了menpofit,menpo3d和menpodetect:
conda install -c menpo menpofit
conda install -c menpo menpofit
conda install -c menpo menpo3d
conda install -c menpo menpo3d
conda install -c menpo menpodetect
conda install -c menpo menpodetect
Next I ran this python script from CMD( python testPy.py ): 接下来我从CMD( python testPy.py )运行这个python脚本:
import menpo.io as mio
from menpo.visualize import visualize_images
images = list(mio.import_images('A:/img/*.png'))
visualize_images(images)
And got this output: 得到了这个输出:
What am I doing wrong and how I can fix it?
我做错了什么以及如何解决它?
It seems that visualize_images
is meant to be used from ipython-notebook
. 似乎
visualize_images
意在从ipython-notebook
。 Calling it in a regular python
script does not seem to be intended by the authors. 在一个普通的
python
脚本中调用它似乎并不是作者想要的。
See also the example in the Visualizing Objects
section of the docs: 另请参阅文档的“
Visualizing Objects
部分中的示例:
%matplotlib inline
import menpo.io as mio
from menpo.visualize import visualize_images
# import_images is a generator, so we must exhaust the generator before
# we can visualize the list. This is because the widget allows you to
# jump arbitrarily around the list, which cannot be done with generators.
images = list(mio.import_images('./path/to/images/*.jpg'))
visualize_images(images)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.