Modulenotfounderror no module named cv2 linux

ModuleNotFoundError: No module named ‘cv2’

ModuleNotFoundError: No module named ‘win32api’
вот такая программка. сначала выскакивала ошибка win32com. установил pywin32. теперь выскакивает.

ModuleNotFoundError: No module named ‘_sqlite3’
Здравствуйте товарищи, пытаюсь запустить одну программу на Python. На Windows запускается хорошо. А.

Ошибка ModuleNotFoundError: No module named ‘matplotlib’
Кто-то может подсказать что сделать? Я просто новичек в Питоне. Буду очень благодарен. import.

При запуске скрипта PyCharm выдаёт «No module named Module»
Здравствуйте, товарищи формучане! Вчера начал изучать великолепный язык под названием Python и.

Покажите что дает вывод этой команды.

P.S. К python ваша проблема отношения не имеет, просто потому что нет такой проблемы.
Ищите свои собственные косяки.

Решение

Installed Pythons found by py Launcher for Windows
-3.7-32 *
-3.7-32

Добавлено через 1 минуту
Запустил скрипт по вашему совету

Помощь в написании контрольных, курсовых и дипломных работ здесь.

No module named ‘random’
Здравствуйте! Нужна помощь! С другом хотим создать совместный проект, он на C# я на python.

No module named codecs питон
Всем привет! Скомпилировал значит питон программу в exe. и вроде все получилось, но вылазит такая.

ImportError: No module named ‘codecs’
Всем привет, перевёл я один файл из py в exe выдаёт ошибку ImportError: No module named ‘codecs’ .

Python. ImportError: No module named ‘gdal’
Доброго времени суток! Такая проблема. Стоит Python 3.4.0, скачал gdal с официального сайта.

Источник

ModuleNotFoundError: No module named ‘cv2’ in Python

In this post, We will see how to resolve ModuleNotFoundError No module named ‘cv2’ in Python.

Table of Contents

Reason for No module named ‘cv2’

Let’s first reproduce this error, and then we will see how to resolve ModuleNotFoundError No module named ‘cv2’ .

We will run cv2 imread example over here.

When you run above program, you might get below output:

You will get this error when cv2 module is not properly installed on your machine.

Resolution for No module named ‘cv2’

Let’s see how we can solve this error.

Windows user

If you are windows user, then follow the below steps:

  1. Open command prompt
  2. Run following command:

In case you are using Anaconda, then follow below steps.

  1. Open command prompt
  2. Update conda navigator with following command:

Linux user

If you are linux user, then follow the below steps:

  1. Open terminal
  2. Run following command:

Add site-packages to PYTHONPATH

It might be possible that PYTHONPATH does not have site-packages .

/.bashrc
Add following line:

That’s all about ModuleNotFoundError: No module named ‘cv2’ in Python.

Share this

Python | cv2 Canny() Method

Python | cv2 cvtColor() Method

Author

How to get variable name as String in Python

Table of ContentsWhat are variable names in Python?How to get a variable name as a string in Python?In Python 2.xIn Python 3.x In Python, there are several ways to convert a string to a variable name, but the reverse process is not exactly utilized so often in the programming world. This article focuses on how […]

Table of ContentsIntroductionPrint the Percentage Sign in PythonUsing the %% characterUsing the format() functionUsing the f-string Introduction In this tutorial, we will see how to print percentage sign in python. The modulus operator (%) or the percentage sign has multiple usages in Python. We use this operator to calculate the remainder for the division between […]

Table of ContentsWhat is a blank line in Python?Ways to print blank line in PythonUsing an empty print() functionUsing the print() function with newline characterUsing the print() function with an empty stringUsing the print() function with the sep parameterWays to print multiple blank lines in PythonUsing the print() function with multiple newline charactersUsing the print() […]

Python add commas to number

Table of ContentsUsing the format() function to add commas to numbers in PythonUsing the fstrings to add commas to numbers in PythonUsing the regular expressions to add commas to numbers in PythonUsing the locale module to add commas to numbers in Python Python allows us to format values to get the final result in our […]

Change the font size of title in Matplotlib

In Python, there are a lot of libraries that are used for data visualization. One of the libraries is the Matplotlib library. The Matplotlib library is a very good library when it comes to data visualisation in python. With the help of this library, many types of graphs and visual representations of the data can […]

Источник

No module named ‘cv2.cv2’

I am a beginner at computers. I use Anaconda python 3.6 in windows 10. I have already installed OpenCV using this command:

But when I try to import cv2 using this:

this error shows up:

How can I install openCV for python?

6 Answers 6

Step 1: Uninstall the opencv first if you have previous/other manually installed (= not installed via pip) version of OpenCV installed (e.g. cv2 module in the root of Python’s site-packages)):

Step 2: Install the package afresh

Hope that works!

Create Virtual Environment

Activate the environment

Install OpenCV and other important packages

Test your installation

In my case, using Python 3.8 on Windows 10 and Pycharm (or VS Code as well), I have this same issue.

Finally I noticed that the Antivirus (Nod32) deletes the cv2.cp38-win32.pyd file that should be in the cv2 folder. I simply paused the protection, installed opencv with pip install opencv-python command and it worked just fine.

I hope it helps someone.

I had this exact same problem on Windows 10. Uninstalling via pip and then reinstalling in my virtual environment fixed everything up for me.

Try reinstalling openCV — it worked for me.

To uninstall:

To reinstall:

I used the answer provided here and it worked.

By running pip install opencv_python-3.4.5-cp36-cp36m-win_amd64.whl

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

Linked

Hot Network Questions

Subscribe to RSS

To subscribe to this RSS feed, copy and paste this URL into your RSS reader.

site design / logo © 2021 Stack Exchange Inc; user contributions licensed under cc by-sa. rev 2021.10.8.40416

By clicking “Accept all cookies”, you agree Stack Exchange can store cookies on your device and disclose information in accordance with our Cookie Policy.

Источник

ModuleNotFoundError: No module named ‘cv2’ #73

Comments

raj6996 commented Sep 1, 2018

Bug/Issue Description:
G:\PySceneDetect-0.5>scenedetect -i «G:\I2\I.mp4» detect-content list-scenes split-video —copy
Traceback (most recent call last):
File «G:\PySceneDetect-0.5\scenedetect.py», line 34, in
from scenedetect.main import main
File «G:\PySceneDetect-0.5\scenedetect_init_.py», line 52, in
from scenedetect.scene_manager import SceneManager
File «G:\PySceneDetect-0.5\scenedetect\scene_manager.py», line 55, in
import cv2
ModuleNotFoundError: No module named ‘cv2’
G:\PySceneDetect-0.5>

Computing Environment:

  • OS: Windows 10 Pro
  • Python Version: 3.7.0 32bit
  • OpenCV Version: Don’t know, don’t install this.

Additional Information:
I downloaded source code zip file, after extracting I run setup file. I don’t install opencv cause I don’t have any issue with previous issue as I did same way.

Media [Videos/Images/Screenshots]:
MP4 file

Remove this section if there is no media associated with the issue/bug report.

The text was updated successfully, but these errors were encountered:

Breakthrough commented Sep 1, 2018 •

You need to install the opencv-python module via:

Also note you can install PySceneDetect the same way via:

If the above methods fail, you can also download the cv2 module from:

For 32-bit Python 3.7, you want the file opencv_python‑3.4.3‑cp37‑cp37m‑win32.whl, and install it via pip (e.g. pip install [file] ). Also note that you can install PySceneDetect via pip now (e.g. pip install scenedetect ).

I’ll try to have a more descriptive error message in the program in the next release, thanks for bringing this up. Let me know if you have any issues getting OpenCV installed.

Edit: I didn’t add OpenCV as a dependency to the setup.py file because the opencv-python package used to not include static libraries, but it seems to now. The next release of PySceneDetect (v0.6) will include this fix, so it installs cleanly when you run:

raj6996 commented Sep 2, 2018

After installing with «pip install opencv-python» command, I got this:

Error: Invalid value for split-video: mkvmerge is required for split-video -c/—copy.
Install the above tool to enable video splitting support.

Then I recalled you told to use MKVmerge.exe on scenedetect folder, so I used portable and copy MKVmerge.exe and it works flawlessly.
by the way, how to use ffmpeg with scenedetect. kindly reply me step by step for being total noob on programing field. thanks.

Breakthrough commented Sep 2, 2018 •

Likewise, you do the same thing (just drop ffmpeg.exe where scenedetect.exe is). I’ll try to make the download link a little bit more apparent, and when I finalize the Windows release (portable/installer), it should include both programs for you as well.

If you have 32-bit Windows, you can find download links for ffmpeg/mkvmerge from:
https://pyscenedetect.readthedocs.io/en/latest/examples/video-splitting/

Let me know if this solves it, thanks again for your help in testing the software!!

raj6996 commented Sep 9, 2018

I recently used 64bit python. so don’t know why this I got error!
C:\Python37\Lib\site-packages\scenedetect>pip install scenedetect
Requirement already satisfied: scenedetect in c:\python37\lib\site-packages (0.5)
Requirement already satisfied: Click in c:\python37\lib\site-packages (from scenedetect) (6.7)
Requirement already satisfied: numpy in c:\python37\lib\site-packages (from scenedetect) (1.15.1)

Here is error:
C:\Python37\Lib\site-packages\scenedetect>scenedetect -i «G:\MGPM\MM2018.mp4» -o «G:\MGPM\A» detect-content list-scenes split-video —copy
Traceback (most recent call last):
File «c:\python37\lib\runpy.py», line 193, in run_module_as_main
«main«, mod_spec)
File «c:\python37\lib\runpy.py», line 85, in run_code
exec(code, run_globals)
File «C:\Python37\Scripts\scenedetect.exe_main
.py», line 5, in
File «c:\python37\lib\site-packages\scenedetect_init
.py», line 52, in
from scenedetect.scene_manager import SceneManager
File «c:\python37\lib\site-packages\scenedetect\scene_manager.py», line 55, in
import cv2
ModuleNotFoundError: No module named ‘cv2’

Breakthrough commented Sep 10, 2018

You need to pip install opencv-python as above again.

raj6996 commented Sep 10, 2018

Thanks Breakthrough, awesome and fast support!

Breakthrough commented Jul 20, 2019

Breakthrough commented Aug 4, 2019 •

Original fix caused new bug (captured by #111).

mrobe commented Oct 17, 2019

I am getting this same error on macOS 10.13.6. Tried everything in this thread but no joy.

hlgope commented Dec 27, 2019

You can’t perform that action at this time.

You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.

Источник

Python — ModuleNotFoundError: No module named

I’m new in Python and I’m having the following error with this simple example:

This is my project structure:

And this is the error when I execute the src/main.py file:

If I move the main.py file to the root and then I execute this file again, works. but is not working inside src/ directory

This is my main.py :

Note: When I execute the same code from Pycharm is working fine, but not from my terminal.

6 Answers 6

Your PYTHONPATH is set to the current directory from the program you execute. So if you’re executing something inside a directory src , it will never be able to find the directory lib because it’s outside the path. There’s a few choices;

  • Just move lib/ into src/ if it belongs to your code. If it’s an external package, it should be pip installed as Henrique Branco mentioned.
  • Have a top-level script outside of src/ that imports and runs src.main . This will add the top-level directory to python path.
  • In src/main.py modify sys.path to include the top-level directory. This is usually frowned upon.
  • Invoke src/main.py as a module with python -m src.main which will add the top-level directory to the python path. Kind of annoying to type, plus you’ll need to change all your imports.

If I may add to MarkM’s answer, if you wanted to keep your current directory structure and still make it work, you could add a setup.py in your root dir, where you can use setuptools to create a package you could install.

If your file had something along the lines of:

And then you do pip install [—user] -e path/to/directory you’ll get an «editable package» which will effectively a symlink to the package in your development directory, so any changes you make will not require a reinstall (unless of course you rejig package structure or add/remove/edit entry points).

This does assume your src/main.py has a main function.

You’ll also need __init__.py files in your «package» directories, even in Python3, as otherwise Python assumes these are namespace packages (Won’t go into detail) and the find_packages() call won’t find them.

This will also allow your relative imports to work. Absolute imports will only work when invoking the script from your entry point but not when calling the script directly in your development directory.

Источник

Читайте также:  Командный файл windows это
Оцените статью