问题
Trying to work with image recognition, I installed Python with OpenCV, following this tutorial. Later on, I decided to give PyDIP a try, running the commands given on this answer.
The first command just don't work:
>>> import PyDIP as dip
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'PyDIP'
I tried to install it using:
(cv) user@pc:~$ python -m pip install PyDIP
Requirement already satisfied: PyDIP in ./.virtualenvs/cv/lib/python3.7/site-packages (0.1.8)
The location of python and pip also seem correct:
(cv) user@pc:~$ which -a python
/home/user/.virtualenvs/cv/bin/python
/usr/bin/python
/bin/python
(cv) user@pc:~$ which -a pip
/home/user/.virtualenvs/cv/bin/pip
/usr/local/bin/pip
I'm using a Virtual Environment (exactly as in the first link), thus the (cv)
on the prompt. There are different Python versions installed, but as I've read, the first one listed with which
should be used. If the python and pip executables are on the same folder as the PyDIP package, what's going on?
I'm using Debian 10, python 3.7.3 and pip 20.0.2.
回答1:
The project has top-level package pydip
(not PyDIP
). So import it:
import pydip as dip
AFAIU PyDIP
is a different package.
回答2:
You are trying to install the PyDIP module by installing it with pip, but the Python Package Index says the pydip module on there is an
Adjudication logic engine for Diplomacy board game
To install it you have to build it from source.
Check here for help.
来源:https://stackoverflow.com/questions/59952057/modulenotfounderror-no-module-named-pydip-although-its-installed