Python 3.6 not finding modules that Python 3.5 can find

Viewed 785

I am trying to make a discord bot based on this repository https://github.com/sleibrock/discord-bots It uses Python 3.6, but when I try to use it I get the error

Traceback (most recent call last):
  File "Bot.py", line 9, in <module>
    from discord.py import Client, Game
ModuleNotFoundError: No module named 'discord'

In python3.5 >>>import discord runs fine.

In python3.6 >>>import discord gives the same error as above.

Any help would be appreciated.

edit: I copied all files from /usr/lib/python3.5/site-packages and /usr/lib64/python3.5/site-packages to the python3.6 counterparts which seems to have fixed the problem. It seems like it wasn't installing anything into the python3.6 folders and was checking the 3.5 folders, making something break with the import.

1 Answers

Python allows for different versions being installed independently of each other. Each one will have its own packages, which make sense because some packages require a minimal (or specific) version, and packages for Python2 could not work in Python3. In addition, packages using compiled C library will be different between 32bits and 64 bits versions.

It is a feature, because it allows you to install some packages only for one of the different versions you have on your system, but it also mean that you have to install them in all the versions you want to use with them.

Related