Python found No module named package that is installed with conda install

雨燕双飞 提交于 2019-12-13 02:36:55

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!