I am currently in PyCharm and I have the following line of code:
import cv2
Nonetheless, it gives me the error No module named cv2
I went to Preferences > Project Interpreter > + then found and downloaded cv2 just fine. In the Project Interpreter it lists cv2 as installed. I am not sure why it still shows that the module doesn't exist. Is there some way to download cv2 via command line. I am on OS X 10.10.
Here is the code I have so far (all the other imports work just fine):
# Program for OCR
import numpy as np
import cv2
from matplotlib import pyplot as plt
I find that sometimes after installing a module in PyCharm it requires a restart in order for it to work. Also, if you do want to do it in the command line, try pip3 install cv2.
Related
I am trying to import tifffile in jupyter. When I do
import tifffile
print(tifffile.__file__)
I get
/home/user/anaconda3/envs/myenv/lib/python3.7/site-packages/skimage/external/tifffile/__init__.py
However, when I run the same command in ipython, same conda environment, I get
/home/user/anaconda3/envs/myenv/lib/python3.7/site-packages/tifffile/__init__.py
How is this possible?? How do I make it so they both import the second one?
from skimage import io
photo=io.imread('myimage.jpg')
print(type(photo))
photo.shape
print(photo.shape)
import matplotlib.pyplot as plt
plt.imshow(photo)
This is my code on my editor. I don't use anacona distribution or jupyter notebook. print(type(photo)) and print(photo.shape) lines works but plt.imshow(photo) doesn't.How to fix it? Though ,I have installed those necessary modules and packeges.
My second question , is there another python distribution which is so efficient like anaconda.
I am currently trying to run my python code in a linux terminal and receive the following error:
import matplotlib.pyplot as plt ModuleNotFoundError: No module named 'matplotlib'
When emailing my schools tech help desk when asking them to download the module they stated that my tensorflow/python3 module's environment has the matplotlib module already installed. However being new to linux and python I am unsure how to access this module to run my code. I have set an environment using the following:
$conda activate tesnorflow
which gave me the access needed to use the xml module. Can anyone give me any advice on how I can access this environment correctly to use the matplotlib module. Thank you
import os
import matplotlib.pyplot as plt
import cv2
from matplotlib.widgets import RectangleSelector
from generate_xml import write_xml
I have Anaconda 3 installed (Python 3.6.3) and I am working on a project that uses the CV2 package in python. Now I am relatively new to python but I have been using this package (via "import cv2" command) in PyCharm with no problems. However, today, I wanted to give Spyder a try. I started using the IDE and everything was working. But all of a sudden, Spyder kept giving me an error when I try to import cv2. I really did not change anything and I only was debugging the script. The error I am getting is as follows:
"""
In [1]: import cv2
Traceback (most recent call last):
File "", line 1, in
import cv2
ImportError: DLL load failed: The specified procedure could not be found.
"""
I cannot figure out how this can be related to the IDE since PyCharm still can import it. Could anybody give me a hint please?
As I know CV2 is python 2x related. When You use CV2 You need copy cv2.pyd file directly to python 2x site-packages.
Hi I am having a little trouble with the module spectrogram which I need to use in order to create spectrograms from my wav files.
I repeatedly get the error message No module named spectrogram when importing on my Windows which is running Python version 2.7.12. In contrast when importing the module on my mac which runs version 2.7.11 I have no problems. I can't find anything that suggests that this is a version specific problem and was hoping someone might be able to help me fix this.
Here is the code I am using to import the needed modules. This runs absolutely fine on my mac, but won't run on Windows.
import glob
import numpy as np
import scipy.io import wavfile
import spectrogram as sp
import os
import matplotlib.pyplot as plt
Spectrogram is a part of scipy, you must make that known.
from scipy import signal
signal.spectrogram(bla,bla,bla)