Philipp
Philipp

Reputation: 415

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 harddrive\opt\homebrew\lib\python3.9\site-packages\ with the foldernames neurokit2 and neurokit2-0.1.7.dist-info.

Simply copying both folders to the respective python3.10 path (harddrive\opt\homebrew\lib\python3.10\site-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?

Upvotes: 2

Views: 14625

Answers (3)

CaptainCsaba
CaptainCsaba

Reputation: 496

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

Upvotes: 1

bytebuff
bytebuff

Reputation: 21

You can try: python3.10 -m pip

Upvotes: 2

Haythem ROUIS
Haythem ROUIS

Reputation: 357

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

Upvotes: 1

Related Questions