1

I am using PyCharm community version 2017.3.1, and Python 2.7.1. I tried installing opencv through PyCharm but it kept giving me an error.

File "C:/Users/user/PycharmProjects/cameratest/cameratest.py", line 2, in import cv2 ImportError: DLL load failed: %1 is not a valid Win32 application.

I downloaded the opencv executable file and tried moving it to my Python 2.7 file but it would still not work, and I tried following the answer here but to no avail.

Jeru Luke
  • 20,118
  • 13
  • 80
  • 87
Danyah
  • 11
  • 2
  • what do you mean by: `I tried installing opencv through PyCharm`? do you mean importing it? Also - is the correct python interpreter being used in PyCharm – MattR Dec 22 '17 at 19:05
  • 1
    Possible duplicate of [ImportError: DLL load failed: %1 is not a valid Win32 application. But the DLL's are there](https://stackoverflow.com/questions/19019720/importerror-dll-load-failed-1-is-not-a-valid-win32-application-but-the-dlls) – ndrwnaguib Dec 22 '17 at 19:44
  • I installed it using the project interpreter in PyCharm, and I was using the correct Python interpreter – Danyah Dec 22 '17 at 19:51

1 Answers1

0

Add the python executable to the windows directory path if operating in windows.

Copy where the python folder is located then

on windows button search path

click "edit the system environment variables"-> environment variables->path

Go to end, and type ";" and paste the windows directory path.

Log off and log back in. Then try executing program.

  • Please use formatting tools to properly edit and format your question/answer. Codes within sentences are to be formatted as `code` Very Important words to be **bold** , lesser important onces *Italic* – Morse Apr 02 '18 at 17:49