问题
I am trying to follow this tutorial which requires imtools
. It looks like I have the package installed, but the Python compiler cannot find it. What's going on here?
Tutorial: http://www.pyimagesearch.com/2016/10/03/bubble-sheet-multiple-choice-scanner-and-test-grader-using-omr-python-and-opencv/
~/py:. cat test_grader.py
from imutils.perspective import four_point_transform~
~/py:. python test_grader.py
Traceback (most recent call last):
File "test_grader.py", line 1, in <module>
from imutils.perspective import four_point_transform
ImportError: No module named imutils.perspective
~/py:pip install imtools
Requirement already satisfied: imtools in /usr/local/lib/python2.7/site-packages
Requirement already satisfied: matplotlib in /usr/local/lib/python2.7/site-packages (from imtools)
Requirement already satisfied: pyyaml in /usr/local/lib/python2.7/site-packages (from imtools)
Requirement already satisfied: numpy in /usr/local/lib/python2.7/site-packages (from imtools)
Requirement already satisfied: scipy in /usr/local/lib/python2.7/site-packages (from imtools)
Requirement already satisfied: python-dateutil in /usr/local/lib/python2.7/site-packages (from matplotlib->imtools)
Requirement already satisfied: pyparsing!=2.0.0,!=2.0.4,>=1.5.6 in /usr/local/lib/python2.7/site-packages (from matplotlib->imtools)
Requirement already satisfied: cycler in /usr/local/lib/python2.7/site-packages (from matplotlib->imtools)
Requirement already satisfied: pytz in /usr/local/lib/python2.7/site-packages (from matplotlib->imtools)
Requirement already satisfied: six>=1.5 in /usr/local/lib/python2.7/site-packages (from python-dateutil->matplotlib->imtools)
~/py:.
回答1:
Seems like you just installed wrong package. The tutorial says you need imutils but you installed imtools instead. Try to install imutils:
pip install --upgrade imutils
回答2:
1) Install imutils
pip install imutils
2) If imutils is already installed, check the installation path.
Requirement already satisfied: imutils in /usr/local/lib/python3.5/dist-packages
3) When I ran python program, I ran into following error:
ImportError: No module named imutils.video
In my case, imutils was only installed under /usr/local/lib/python3.5/dist-packages path, once I copied this folder to /usr/local/lib/python2.7/dist-packages, it worked! Hope this is helpful.
回答3:
Try sudo pip2 install imutils
I have solved this issue in Raspberry Pi 3 B using
sudo pip2 install imutils
回答4:
You are installing imtools
which is completely different than imutils
Run
pip install imutils
or
conda install -c conda-forge imutils
if you are in a conda environment.
回答5:
I installed imutils with "pip install packageName --target pathOfDirectorty" in to the python 3.5 folder and everything went right
回答6:
most probably it is getting installed in global and not in local. Check if imutils is in this folder C:\Program Files\Python37\Lib\site-packages
copy paste imutils and imutils-0.5.2.dist-info folder in your local C:\usersid\AppData\Roaming\Python\Python37\site-packages
NB:AppData folder is hidden
or
pip install --user imutils
回答7:
In my default base conda environment (using Anaconda prompt), did pip install --user imutils
and accessing the same by import imutils
from inside my_env
created by virtualenv.... works fine..
回答8:
I don't know about python but I needed to run a python script which needed this imutils.perspective part.
Here how it worked for me.
I installed all latest versions of using pip3 :
- python-opencv (4.4.0)
- imutils (0.5.3)
- numpy (1.19.2)
Still I could not find any perspective after importing imutils and trying tab complete after "imutils."
I tried uninstalling and reinstaling all packages but still no luck. But I somehow managed to do it trying different codes.
I installed scipy(1.5.3) using sudo pip3 install scipy
first.
Then using import imutils
and from imutils import perspective
I was able to use it.
No need to import scipy, just install it.
来源:https://stackoverflow.com/questions/40821954/no-module-named-imutils-pespective-after-pip-installing