1

I'm using Kali Linux and have Python2.7 and Python3 running side-by-side.

I'm trying to install the pyasn1 module in my python2.7 path but when I type

pip install pyasn1

it says it's already installed in my python3 path

Requirement already satisfied: pyasn1 in /usr/lib/python3/dist-packages (0.4.8)

How do I install the pyasn1 module under my python2.7 path using pip?

Thanks!

  • Does this answer your question? [pip2 installation on ubuntu 20.04](https://stackoverflow.com/questions/65869381/pip2-installation-on-ubuntu-20-04) – Maicon Mauricio Jul 02 '21 at 02:07
  • This is the reason it's recommended to run `python -m pip` instead of running the `pip` executable. If you run `python -m pip`, you know that pip is installing the module into the same Python that you get when you run the `python` command. (You can use `python2 -m pip`, for example, or `python3 -m pip`.) – Dietrich Epp Jul 02 '21 at 02:12
  • @MaiconMauricio I basically came to the same resolution just before your comment, but thanks for the reply! – spookymonkey Jul 02 '21 at 02:22
  • @DietrichEpp thanks for the tip! I'll use this method going forward but for the moment I just installed pip2 which is an alternative approach and seems to have solved my issue. – spookymonkey Jul 02 '21 at 02:24

1 Answers1

1

So, it turns out I'm an idiot and the 'pip' command was linked to python3.

To run pip for python2, I installed pip2 which is apparently used specifically to install modules for python2

Here are the commands I used in case any other n0obs run into this issue:

wget https://bootstrap.pypa.io/pip/2.7/get-pip.py
python2 get-pip.py
pip2 install pyasn1