skip to Main Content

I installed pytz on Debian Buster via

sudo pip install pytz

and the install completed cleanly. However, when I attempt to

import pytz

python throws an exception

    import pytz
ModuleNotFoundError: No module named 'pytz'

I installed pytz 2019.3 via pip 18.1. Any thoughts on why pytz is not found?

Update: I ran pip -v and now see that it is using python2.7. Is there a way to tell pip to use python3? I cannot remove python2 as it is a dependency for a number of packages.

2

Answers


  1. Chosen as BEST ANSWER

    Adding to @emrah-diril answer:

    sudo apt-get -y install python3-pip
    

    and then use

    sudo pip3 install pytz
    

  2. Use pip3 to install modules for python3

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search