1

I'm trying to use my PiCamera, and while doing that (writing some python code to use it), I keep getting this error message:

Traceback (most recent call last):
  File "/home/pi/Desktop/picamera.py", line 1, in <module>
    from picamera import PiCamera
  File "/home/pi/Desktop/picamera.py", line 1, in <module>
    from picamera import PiCamera
ImportError: cannot import name 'PiCamera'

The camera is working because I tested it in the command line: raspistill -o image.png

I am using Python 3.

  • try this import picamera pay attention to the capitalization – Steve Robillard Apr 14 '17 at 19:26
  • @SteveRobillard I did from picamera import PiCamera Also I tried just to import picamera and then do: camera = picamera.PiCamera() But in both situations I receive the error from above. – Fineas Silaghi Apr 14 '17 at 19:37
  • try this pip3 install PiCamera then retry the import – Steve Robillard Apr 14 '17 at 19:47
  • @SteveRobillard : I've tried and what I get is: Requirement already satisfied – Fineas Silaghi Apr 14 '17 at 19:51
  • how did you fix the error ? I am having the same problem. If you could explain it would be nice of you – mnabeel Nov 25 '17 at 9:04
0

The problem is that I used python 3.4, and while compiling the code in terminal (python script.py) it was compiled in python 2.7. I have both versions installed.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.