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

Question:

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?

Asked By: Philipp

||

Answers:

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

Answered By: Haythem ROUIS

You can try: python3.10 -m pip

Answered By: 挖掘机小王子

If you really want to make sure you are using a specific version of Python pip, you can use the full path to the Python executable as your first command then -m pip before your pip command. For example:

C:/Users/yourpath/Python310/python.exe -m pip your_pip_command
Answered By: CaptainCsaba
Categories: questions Tags: ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.