'Module pyfiglet not found

The code :

import pyfiglet

print(dir(pyfiglet))

The error :

ModuleNotFoundError: No module named 'pyfiglet'

Even though I downloaded "pip 21.0.1" and imported it, it does the same thing to "termcolor" package.



Solution 1:[1]

Before you can import a library, it needs to already be on your drive. You are importing it into your file. In order to get it onto your drive in the first place, you have to install it.

From the command prompt, type:

pip install pifiglet

Once you've done that, you should be able to import it.

Solution 2:[2]

sorry i install pip and the command

pip install pifiglet

report this results equirement already satisfied: pyfiglet in /usr/local/lib/python3.9/dist-packages (0.8.post1)

but if i do the original command i have this response from pyfiglet import figlet_format ImportError: cannot import name 'figlet_format' from 'pyfiglet' (/usr/local/lib/python3.9/dist-packages/pyfiglet/init.py)

but in this path there is the file...

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 Ruli
Solution 2 mondomarcio89