'Python - Notion API - Can't import module
I'm trying to use Notion API for some automation processes but I am having some trouble importing the packages and I already try a lot of imports. I've this code:
from notion_database.database import Database
my_token = "my_token"
D = Database(integrations_token=my_token )
print(D.list_databases(page_size=100))
To run this code I made the following imports:
pip install notion-database
pip install notion-py
pip install "notion==0.0.25"
pip install notion
All of them were installed correctly and I don't have my script name as "notion.py" :D
But when I run my code I got:
from notion_database.database import Database
ModuleNotFoundError: No module named 'notion_database'
Does anyone know what I am doing wrong?
Thanks for the help!
Solution 1:[1]
It looks your code is fine. More likely, your python and pip points onto two different python versions.
I would suggest you create an environment (virtualenv or pyenv) and reinstall the packages using this command:
sudo python -m pip install notion-database
sudo python -m pip install notion-py
sudo python -m pip install "notion==0.0.25"
sudo python -m pip install notion
Solution 2:[2]
maybe you have not install notion
successfully.
try to replace pip install notion
to pip install notion --user
,after that maybe there is no error with run "import notion".
good luck!
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Jerome |
Solution 2 | Even Zhang |