When writing Python code using compiled extensions (the OpenCV Python bindings, for example), PyCharm doesn\'t seem to be aware of their availability. The imports are marked
I have noticed a difference in pycharm behavior depending on the way to import. using:
import cv2
the auto completion doesn't work,
while with:
from cv2 import cv2
auto completion works
I hate to give a "works for me" answer, but maybe the details on my environment will help you identify the problem on your end.
I've never used PyCharm before, but I just did a test on Mac 10.6.6 using PyCharm 1.1.1, with Macports opencv +python26. The autocomplete worked fine for me the first time. I also closed and re-ran PyCharm and was able to autocomplete without doing anything further. I also had no issue with autocomplete for other native extensions I tried like cjson, procname.
.
Perhaps it is a platform-specific issue (Windows?), or a bug affecting an older version of PyCharm?
In my case on OS X 10.8 and PyCharm 3, IDE was automatically picking different installations of Python. I noticed this in Eclipse Pydev, which picked up the one right one and worked as expected. It was not easy to notice the difference between the two: /System/Library/Frameworks/Python.framework/Versions/2.7/bin/python /opt/local/Library/Frameworks/Python.framework/Versions/2.7/bin/python