How to make python3 recognize the emoji module?

Asked

Viewed 503 times

0

I did the installation of the emoji module with

sudo apt-get install python-emoji

After installed, I confirmed the installation with

pip install emoji

I get the message

Collecting emoji
Installing collected packages: emoji
Successfully installed emoji-0.5.4

However, import emoji is recognized in python2 but is not recognized in python3. The program testes.py, given by

import emoji
print(emoji.emojize('ola, mundo! :thumbs_up:'))

Wheel correctly with python testes.py, but with python3 testes.py returns the message

ModuleNotFoundError: No module named 'emoji'

python3 does not seem to find the module. How to solve this problem?

I use the editor vi under Xubunto.

Note 1: I checked this question, but it does not answer my question. I already have the module installed and python2 can run it. But python3, which I use most, can’t access the module.

Note 2: I managed to install with

$ git clone https://github.com/carpedm20/emoji.git

$ cd emoji

$ python setup.py install

But now I get the message

AttributeError: module 'emoji' has no attribute 'emojize'

Note 3: I found that the problem is that emoji libraries are available for python3.6 but not for python3.8. I can run the program normally with

python3.6 testes.py

However, with python3.8 testes.py I get the message

AttributeError: module 'emoji' has no attribute 'emojize'

How do I get python3.8 access to the module libraries?

2 answers

3

As you have already said that you have two versions of python running, with different results for each version, so it is likely that your default version of the system is python 2. Try the following:

  1. Make sure pip3 is installed:

    $ pip3 --version

  2. Case nay is:

    $ sudo apt update

    $ sudo apt install python3-Pip

  3. if it is installed:

    $ pip3 install emoji

  • 1

    I followed the steps and it didn’t work. I keep getting the same error.

  • @Peter, and when he does python3 -m pip install emoji?

  • @Gustavosampaio, I tried, but it still didn’t work. I get the same mistake

1

You must be using python 2 as the default system, so when you use Pip it installs the python 2 package. Try it like this:

pip3 install emoji
  • I followed these steps and it didn’t work. I keep getting the same error message.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.