4

I am trying to run a python script using OpenCV with PyPy, but all the documentation that I found didn't work.

The installation of PyPy went well, but when I try to run the script it says that it can't find OpenCV modules like 'cv2' for example, despite having cloned opencv for pypy directly from a github repository.

I would need to know how to do it exactly.

1
  • are you using python 2.7? Commented May 6, 2019 at 12:01

2 Answers 2

1

pip install opencv-python worked well for me on python 2.7, I can import and use cv2.

Sign up to request clarification or add additional context in comments.

8 Comments

I am currently using python 2.7, and PyPy 2.7 as the project interpreter with Pycharm. However upon using your command it gives me this error: Could not find a version that satisfies the requirement opencv-python (from versions: ) No matching distribution found for opencv-python
I'm using Python 2.7 with venv. In PyCharm, go to settings, project interpreter, and hit the "+" button on the right. Here you can add packages to your project interpreter. Search opencv-python and download it. It worked well for me, I use template matching in my project and I'm doing this
Are you doing all of this while having your project interpreter as PyPy 2.7?, doing what you say gives me the error I talked before, could not find a version that satisfies the requirement.
Nope I'm actually using Python 2.7 (venv) interpreter, I'll try with PyPy. I used to use cv2 with PyPy and it worked well by adding opencv-python.
Now that I think about it, I am trying to add the libraries by using python 2.7 and pypy but they are not located in venv, just locally on my pc. When I try to add libraries using python 3.7 (located in venv) it let's me without issues. How could I add for example pypy and python 2.7 to venv via Pycharm? It did that automatically when I created a new python interpreter, but I am not sure how to add a new one to venv. That could be the issue correct? Pypy and python 2.7 not being located in venv
|
0

which repo did you clone? The cononical repo for building opencv for python is https://github.com/skvark/opencv-python, but this uses NumPy and will be slow for PyPy.

There is also https://github.com/Magnetic/opencv-cffi which is an incomplete wrapper for a older version of OpenCV. It has an example how to use it https://github.com/Magnetic/opencv-cffi/blob/master/examples/contrast_and_brightness.py

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.