When installing a new Python version with pyenv, you may need to migrate all the installed packages from a previous Python version to the new one. For an example, I had Python 3.5.2 and installed a lot of packages with pip. After I install Python 3.6.0, I want to make the new Python have all the packages under the Python 3.5.2 version.
Just need to run the following commands:
# Switch to Python 3.5.2 version.
Actually “pyenv” provides an “pyenv-pip-migrate“ plugin to do the same thing but it needs to be installed separately, and the plugin uses the same commands above. So I think it’s more easier to use the commands directly.