问题
I do notice there are some similar question asked by different people about why python couldn't locate the packages that are installed using conda install
command in their conda environment.
Take pyqt for example.
1 I create conda environment:
conda create -n myenv python=2.7 pip
2 Activate environment:
source activate myenv
3 install packages:
conda install pyqt
4 run python:
python
import pyqt
Error report: ImportError: No module named pyqt
5 check out packages installed:
pip list
doesn't give pyqt
but conda list
will show pyqt installed
6 I just noticed that the "conda install" packges are under /env/conda-meta
, but "pip install" packges are under env/lib/python2.7/site-packages (and bunch paths sys.path gives)
.
If we could simply append the /env/conda-meta to the path, it'll be great, but after appending operation, I eixt() python and re-run python, checking out the sys.path again, the /env/conda-meta is not there anymore.
Does anyone know how to solve it?
回答1:
The issue is that you're using the wrong module name. The correct import statement for pyqt
is
import PyQt5
or whatever version you installed.
来源:https://stackoverflow.com/questions/53197674/python-found-no-module-named-package-that-is-installed-with-conda-install