SimpleCV无法正常工作Python3.4 SyntaxError:“打印"调用中缺少括号 [英] SimpleCV not working Python3.4 SyntaxError: Missing parentheses in call to 'print'

查看:401
本文介绍了SimpleCV无法正常工作Python3.4 SyntaxError:“打印"调用中缺少括号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我想在运行OS X 10.10.3(Yosemite)的Mac上安装SimpleCV.我已经安装了python 3.4.3,并且还安装了pygame(我显然需要SimpleCV).我已经通过运行安装了SimpleCV

So I'm trying to install SimpleCV on my Mac which is running OS X 10.10.3 (Yosemite). I have python 3.4.3 installed and pygame is also installed (which I apparently need for SimpleCV). I have installed SimpleCV by running

    sudo pip3 install SimpleCV

,它下载并安装了SimpleCV-1.3.tar.gz. 然后,当我尝试在python中运行它时,我得到的是:

and it downloaded and installed SimpleCV-1.3.tar.gz. Then when I try running it in python this is what I get:

$ python3
Python 3.4.3 (default, Jun 10 2015, 19:56:14) 
[GCC 4.2.1 Compatible Apple LLVM 6.1.0 (clang-602.0.53)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import SimpleCV
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.4/site-packages/SimpleCV/__init__.py", line 3, in <module>
    from SimpleCV.base import *
  File "/usr/local/lib/python3.4/site-packages/SimpleCV/base.py", line 139
    print 'unit test'
                ^
SyntaxError: Missing parentheses in call to 'print'
>>> 

推荐答案

SimpleCV仅与python 2.x和pygame以及与其一起安装的OpenCV兼容. 这是一个问题,因为python 2.x即将被淘汰.

SimpleCV is only compatible with python 2.x and pygame and OpenCV installed along with it. This is a problem because python 2.x will soon be phased out.

我建议尝试在python 2.x环境中运行代码.

I would suggest trying to run your code in python 2.x environment.

如果您尝试在anaconda发行版中创建它,请通过以下代码创建一个新环境:

if you are trying to create it in an anaconda distribution then create a new environment by the following code:

conda create --name py27 python=2.7

然后您还需要可以在该py27环境中安装的pygame和opencv

and then you would also be needing pygame and opencv along with it which can be installed in that py27 environment

因此在

conda activate py27

然后安装pygame和opencv

and then install pygame and opencv

conda install -c cogsci pygame
conda install -c menpo opencv

然后您可以尝试运行代码,并且单元测试错误应该消失.

and then you can try running your code, and the unit test error should disappear.

如果您不使用anaconda发行版,则只需安装必要的库,即安装了pygame和OpenCV的python 2.x.

And if you're not using anaconda distribution then just installed the necessary libraries which are python 2.x with pygame and OpenCV installed.

这篇关于SimpleCV无法正常工作Python3.4 SyntaxError:“打印"调用中缺少括号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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