Pip successfully installed module not found: ImportError: No module named xlwt

Total
2
Shares

My OS: win 10 ,

installed:

  • python 2.7 ( command is python)
  • python 3.9.5 ( command is python3)
  • pip , pip3 ( both for python3, seems )

pip command:

c:>pip3 config list -v
For variant 'global', will try loading 'C:ProgramDatapippip.ini'
For variant 'user', will try loading 'C:Userslueluepippip.ini'
For variant 'user', will try loading 'C:UsersluelueAppDataRoamingpippip.ini'
For variant 'site', will try loading 'c:usersluelueappdatalocalprogramspythonpython39pip.ini'

c:>pip config list -v
For variant 'global', will try loading 'C:ProgramDatapippip.ini'
For variant 'user', will try loading 'C:Userslueluepippip.ini'
For variant 'user', will try loading 'C:UsersluelueAppDataRoamingpippip.ini'
For variant 'site', will try loading 'c:usersluelueappdatalocalprogramspythonpython39pip.ini'

I installed xlwt via pip, and I can see it’s installed :

c:>pip install xlwt
Requirement already satisfied: xlwt in c:usersluelueappdatalocalprogramspythonpython39libsite-packagesxlwt-1.3.0-py3.9.egg (1.3.0)

enter image description here

However, when I try to import it, got error: No module named xlwt

c:>python
Python 2.7.15 (v2.7.15:ca079a3ea3, Apr 30 2018, 16:30:26) [MSC v.1500 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import xlwt
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named xlwt
>>> exit()

Also, I used pip3 install xlwt successfully, but run python3 ... import xlwt failed. full log:

C:filesdong_tai_pai_fang_ji_suanpython_code>pip3 install xlwt
Requirement already satisfied: xlwt in c:usersluelueappdatalocalprogramspythonpython39libsite-packagesxlwt-1.3.0-py3.9.egg (1.3.0)

C:filesdong_tai_pai_fang_ji_suanpython_code>python3
Python 3.9.5 (tags/v3.9.5:0a7dcbd, May  3 2021, 17:27:52) [MSC v.1928 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import xlwt
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'xlwt'
>>>

how to resolve this?

should I configure the windows PATH or something for python/pip ?

thanks

edit:

maybe I installed multiple python3:
enter image description here


Solution

maybe I installed multiple python3

Do python3 -m pip install xlwt, this always install for python3 (python launched when you do python3 in terminal), then it should be possible to import installed module in python3. If you want to know more about that read Installing Python Modules in docs.

Leave a Reply

Your email address will not be published. Required fields are marked *