I just installed Python 3.6 and run terminal, tried to import
any of the modules I already installed in 3.5 (rsa, matplotlib, enchant, ...) and it returned:
ModuleNotFoundError: No module named 'module_name'
However, they still work when I run Python 3.5. What should I do?
If you install a different Python version you will not have the modules you did already install for your old version.
Each Python version you install has its own working directory, and its own modules. Modules installed for a certain version of Python, in general, cannot be used by other versions, older or newer. This is because Python modules often need precompiled files and version-specific features to work on a certain version of Python. For example, you cannot use a module for Python 2.7 on Python 3.6, since that a lot of stuff changed from version 2 to 3.
This means that you will have to re-install any module you need on the new version of Python again, which can easily be done using PIP running pythonX.Y
, where X.Y
is the version number, like this:
python2 -m pip install SomePackage # default Python 2
python2.7 -m pip install SomePackage # specifically Python 2.7
python3 -m pip install SomePackage # default Python 3
python3.6 -m pip install SomePackage # specifically Python 3.6
Note also that copying the old site-package folder is not the same thing as reinstalling the modules, and should never be done.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With