Skip to content
Advertisement

How to use pip for Python3.10 instead of Python 3.9?

I would like to use the Python toolkit Neurokit2 (https://neurokit2.readthedocs.io/en/latest/index.html) on Mac OS 12.3.1 in Python 3.10.4.

Python 3.10.4 was installed via homebrew. Python 3.9 was also installed via homebrew because of dependencies for jupyterlab and scipy.

When installing Neurokit2 via pip3 install neurokit2 pip automatically installs the toolkit only for python 3.9. The installation is located in harddriveopthomebrewlibpython3.9site-packages with the foldernames neurokit2 and neurokit2-0.1.7.dist-info.

Simply copying both folders to the respective python3.10 path (harddriveopthomebrewlibpython3.10site-packages) does not do the job.

Furthermore, the command pip3.10 install neurokit2 also installs the toolkit into the python3.9 path.

Do I have to uninstall and then reinstall pip so that it automatically gets assigned with Python3.10, or are there better ways to solve this problem?

Advertisement

Answer

The best way to handle multiple versions of Python in a single machine is to use pyenv.

You can install multiple versions and choose which one to activate at a local path or at a global context : https://github.com/pyenv/pyenv

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement