简体   繁体   中英

Cannot import an installed module

I cannot import a module which is installed

ModuleNotFoundError: No module named 'Google '

It is installed as when I run

pip install Google

I get:

Requirement already satisfied: soupsieve>1.2 in /Users/sebastianstros/Library/Caches/pypoetry/virtualenvs/mama-bots-9Qh4WGwv-py3.9/lib/python3.9/site-packages (from beautifulsoup4->Google) (2.3.2.post1)

But importing the module I get:

Traceback (most recent call last):
  File "/Users/sebastianstros/PycharmProjects/mama-bots/mama_bots/bots/calendar_bot/personal_calendar_bot.py", line 7, in <module>
    from Google import Create_Service
ModuleNotFoundError: No module named 'Google'

Even though this evaluates to True:

print(sys.path[-1] == "/Users/sebastianstros/Library/Caches/pypoetry/virtualenvs/mama-bots-9Qh4WGwv-py3.9/lib/python3.9/site-packages")

Which is surprising to me as sys.path is a list of paths from which modules can be taken and the right hand side of the statement is the location of the module.

Because there is actually no package called Google , you may try pip install google for the Google libraries.

You can check all the packages from PyPI website .

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