I know there's a lot of answers related to this question, but I really couldn't find the answer so I'm here.
The problem started when I saw cv2 doesn't import on Python 3.8. So I found there's OpenCV whl file available for Python 3.8, I downloaded the whl file, pip installed into Python 3.8 using command:
python3.8 -m pip install opencv_python-4.1.2.30-cp38-cp38-macosx_10_9_x86_64.whl
I confirmed it works on Terminal I opened Python3.8 and entered command: import cv2
And it imported just fine, but when I try import cv2 on my PyCharm project this message keeps showing:
Error message
I looked everywhere and I really can't find answer anymore. If anyone can help me I would be very thankful.
Related
I've been trying to make a project with opencv, so I followed the YouTube video (It's in python), the video told me to go to cmd (win10) and use the command "pip install opencv-python" so that I can use the command import cv2. But the problem is after I did everything it still gave me an error.
I've done some research on it and nothing seem to work. I tried restarting my laptop or reinstall opencv, but nothing works for me. I'm thinking maybe it's because the PATH was wrong so it couldn't access it? But I've never worked with these before so I don't know what I'm supposed to do. I've seen some people with the same problem but the solution doesn't seem to work.
I'm using:
python 3.10.8
windows 10
IDLE Shell 3.10.1
Welcome to Stack Overflow!
Try installing with pip3
pip3 install opencv-python
I am a beginner in terms of using python. Currently, I got python 3.7 and I am using anaconda as IDE. For my project, I need to detect the location and brightness of points/dots in an external imported picture. I figure I could use the modul OpenCV. Unfortunately, I am stuck right now with the problem to import the module cv2. I already successfully installed the package using
python -m pip install OpenCV-python
on command prompt. OpenCV Version which was installed is 4.2.0.34. While compiling the test script of OpenCV on Spyder
import cv2
print(cv2.__version__)
I got this message
"ImportError : DLL load failed : The Modul was not found."
Can somebody let me know please how to fix this problem? Is somehow the version of OpenCV I got not compatible with the Python version? I already watched and followed many tutorial videos on Youtube, but I couldn't find the solution. I tried to copy the cv2.pyd to the site-packages folder in
C:/user/Anaconda3/Lib/site-packages directory
still it didn't fix the problem...
I would appreciate any answers and help I could get here. Thank you!
try installing it using these commands in the following order:
conda update anaconda-navigator
conda update navigator-updater
pip install opencv-python
It should work fine.
Try conda install opencv
or conda install -c menpo opencv
In Pycharm (runs on Python 3.7), I am doing this Computer Visions tutorial which requires the package imutils. The interesting thing is that if I run this file named "neural_style_transfer", it works fine. But according to the tutorial we must run the following in the windows terminal
neural_style_transfer.py --image images/giraffe.jpg \
--model models/eccv16/the_wave.t7
When I run that, it says "no module name imutils".
Some more background: For some reason, when I use the IDE spyder, there is also no module named imutils. But I think it is because my spyder is still in python 3.6.
My imutils is definitely located in the python 3.7 packages stuff, I can find it at:
C:\Users\andre\AppData\Local\Programs\Python\Python37-32\Lib\site-packages\imutils
Found the solution! Anyways, you have to call:
py -m pip install imutils in your terminal
The logical explanation I found is this: I have 3 versions of pythons on my computer: 2.7, 3.6, 3.7. I have 3.6 because tensorflow doesn't support python 3.7 yet. But if you only call pip install imutils, it only downloads imutils to your python 3.7 site packages, which is not shared across all the python versions and is not the version I use when I do deeplearning. Therefore, to download imutils to python 3.6 (the version I use), use py -m pip install imutils.
There's still many potholes in my conjecture though: for example, py-m pip install sounds like it doesn't specify downloading to 3.6, so why does it download to 3.6? And, for most of the time, I thought I was working on python 3.7, which should had imutils installed, but maybe I was working on 3.6 instead of 3.7.
I'm trying to get opencv for python on my mac running mavericks. After googling/stack overflow seraching I tried:
brew install homebrew/science/opencv
Based on the terminal output it looks like that worked.
To verify I wrote a python script that simply contains:
import cv2
print("Hello")
I get no module named cv2. When I try looking at the installed modules by typing help('modules') I don't see cv or cv2. This leaves me with two conclusions: either I didn't properly install opencv or import cv2 isn't actually importing cv2 and python is looking in the wrong location for cv2. Any suggestions would be appreciated.
According to this guide, if you add the following to your .bash_profile it should fix your issue:
export PYTHONPATH=/usr/local/lib/python2.7/site-packages:$PYTHONPATH
You could update your pythonpath,
but you would probably be better served running 'brew install python' so that you are not using system python. System python and brewed python look for modules in different locations.
EDIT:
Asked questions, updated the above.
This worked for me. Install X code from App Store.
Uninstall Homebrew
Uninstall and clean Anaconda
Reinstall Anaconda and Homebrew
Install OpenCV using conda install -c menpo opencv3
It should be good to go. Remember import it as import cv2
In case of any library errors try this conda install -c conda-forge basemap fiona
Hope it helped
So I'm following the 'Think Python' PDF guide and this is my first real hurdle. I tried to follow a guide to install it but it's completely over my head. I know this is vague but if anyone could guide me through it like I'm a pensioner I'd be grateful.
I'm currently using Python 2.7.6. I think I downloaded setup tools and PIP but I can't be too sure.
Sorry for the openness and vagueness of this question but I'm quite stuck.
Edit: Since you're on Windows, I suggest you download and run this installer for Pip.
Once that's done, if you've downloaded and installed Pip correctly, all you should have to do is open a terminal, type pip install swampy, and press return.
In order to test if you've installed Swampy correctly, do the following:
Open a command prompt.
Type python and press return
Type from TurtleWorld import * and press return.
If you've installed Swampy correctly, you shouldn't see any error messages. If you see something like this ImportError: No module named TurtleWorld, Swampy isn't installed correctly yet.
References:
This answer on installing Pip on Windows.
This answer on
installing Swampy on Windows.
This page on setting up Swampy
from an intro CS course at UCSB.
Download Swampy package tar.gz, extract it:
$ tar -zxvf [swampy-package-name]
cd to Swampy folder, in command line, you type:
$ sudo python setup.py install
run python
$ python
from Swampy.TurtleWorld import *
or run follow example of think python
$ python polygon.py
It work by python. some other python version doesn't work.