M
M
Mark Adams2016-10-01 17:23:29
Python
Mark Adams, 2016-10-01 17:23:29

How to choose Python version when installing a package via pip?

Previously, I used pip to install the package for version 2, and pip3 for version 3, but now through pip all packages are installed on python 3. How to install package on 2 via pip?
macOS

Answer the question

In order to leave comments, you need to log in

3 answer(s)
S
Sergey, 2016-10-01
@sergnosov1

You read it wrong, it asks for the -H flag not when calling pip, but when calling sudo
Try
sudo pip install <package for 2nd python>
sudo pip3 install <package for 3rd python>

G
gasabr, 2016-10-02
@gasabr

pip2 install <имя пакета>
pip --version # чтобы проверить,  для какой версии пакет будет установлен по умолчанию

S
Sergey Pankov, 2016-10-07
@trapwalker

In general, you need to learn pip through the python to which you need a lib. Try pip2 or see whereis pip and alias pip to the second python.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question