简体   繁体   中英

import dlib ModuleNotFoundError: No module named 'dlib' in python IDLE

I have installed dlib using Anaconda 3 prompt. It has shown me that it got installed successfully. I checked through command import dlib it did not give me any error even I checked the version also it came up with 19.9.0 .

But when I open my program in IDLE and run the program its showing me error

import dlib ModuleNotFoundError: No module named 'dlib'

Even from command prompt, I am getting same error.

What is the issue? I am using Python 3.6.

Installation process of dlib using anaconda3 :

<code> dlib </ code>的安装过程

You have installed the package in different version of python and importing the package in other version of the python.

Package is installed. in virtual environment( 3.6.8 ) and is being imported in standard system python ( 3.6.0 ).

So either you need to use this virtual environment for your application otherwise you will need to install the package into global system python.

Extending @Rohit's answer :

As you have installed dlib in Anaconda, you need to run the program using Anaconda prompt.

By default, IDLE and python command in command prompt use Python that is installed system wide (which is Python 3.6.0 in your case).

But to use dlib which is installed in Anaconda's virtual environment ( env_dlib ) you need to do:

  1. Open Anaconda prompt.
  2. Activate env_dlib environment: activate env_dlib
  3. Run the Python file which uses dlib package: python FILENAME

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM