2012-06-30 50 views
1

我最近在遇到一些问题后成功运行了SimpleCV。我现在已经安装了SimpleCV,并正在使用Eclipse Indigo。但是,我从SimpleCV导入的所有内容都标记为红色,并且Eclipse声明它无法找到指定的导入(即使导入的函数工作正常)。使用Eclipse进行SimpleCV代码完成

是否有任何方法让Eclipse识别从SimpleCV导入,以便我可以使用其Ctrl-Space代码完整功能?

我试图将“SimpleCV”添加到Forced Builtins中,但没有成功。 (这是我做的,当我有同样的问题了OpenCV的,然后它的工作)

感谢您的咨询!

回答

1

SimpleCV中导入非常多。我一直在努力解决你遇到的同样的问题。而他们之所以不想修复它(按他们在其网站上(http://help.simplecv.org/question/472/code-completion-with-eclipse/答案)是不是因为他们“都使用vim,emacs的,六”,但因为有很多他们的代码依赖于很多拉库到本地命名空间为*进口,最好是惰性编程,否则编程确实不好。 .py文件已被导入,这两个文件都有大量的导入,我想知道为什么导入SimpleCV需要花费2秒以上才能在我的电脑上运行一个SSD,现在我知道了。文件有这些进口:

from SimpleCV.base import * 
from SimpleCV.Camera import * 
from SimpleCV.Color import * 
from SimpleCV.Display import * 
from SimpleCV.Features import * 
from SimpleCV.ImageClass import * 
from SimpleCV.Stream import * 
from SimpleCV.Font import * 
from SimpleCV.ColorModel import * 
from SimpleCV.DrawingLayer import * 
from SimpleCV.Segmentation import * 
from SimpleCV.MachineLearning import * 

而且他们base.py文件还没有更多的进口:

import os 
import sys 
import warnings 
import time 
import socket 
import re 
import urllib2 
import types 
import SocketServer 
import threading 
import tempfile 
import zipfile 
import pickle 
import glob #for directory scanning 
import abC#abstract base class 
import colorsys 
import logging 
import pygame as pg 
import scipy.ndimage as ndimage 
import scipy.stats.stats as sss #for auto white balance 
import scipy.cluster.vq as scv  
import scipy.linalg as nla # for linear algebra/least squares 
import math # math... who does that 
import copy # for deep copy 
import numpy as np 
import scipy.spatial.distance as spsd 
import scipy.cluster.vq as cluster #for kmeans 
import pygame as pg 
import platform 
import copy 
import types 
import time 

from numpy import linspace 
from scipy.interpolate import UnivariateSpline 
from warnings import warn 
from copy import copy 
from math import * 
from pkg_resources import load_entry_point 
from SimpleHTTPServer import SimpleHTTPRequestHandler 
from types import IntType, LongType, FloatType, InstanceType 
from cStringIO import StringIO 
from numpy import int32 
from numpy import uint8 
from EXIF import * 
from pygame import gfxdraw 
from pickle import * 

你知道他们要求把所有这些不同的简历库和应用“Python化”的方式给他们。但是,这种导入混乱只是证明他们错了。

我在固定的进口尝试是那些进口*的从他们init.py文件与它呈现在Eclipse中代码完成滞有助于消除。然后导入SimpleCV鸡蛋目录(C:\ Python27 \ LIB \站点包\ simplecv-1.3-py2.7.egg)到Eclipse作为外部库。在那之后,我就能够运行这个命令:

from SimpleCV.ImageClass import Image 

也是一样的进口颜色:

from SimpleCV.Color import Color 

有周期性的进口,所以要小心那些,因为他们可能会咬你。在导入SimpleCV.ImageClass之前尝试导入SimpleCV.Color时,我自己有一个较早的版本。请注意,根据上述说明,我似乎可以从Eclipse获得代码完成。

+1

我怕我没有SimpleCV我的系统上了,所以我不能检查它。过了一段时间,我放弃了,但是,切换到OpenCV。一旦你通过了最初的学习曲线,那真的不是那么糟糕。干得好虽然让它工作!我只是没有耐心...... – casper