0

I had a working setup where I'd type pip install some-library and then I could import it into my projects. Then I decided to install miniconda which installed another version of python (3.8) that my system started defaulting to.

By running this command in terminal (I'm on a mac): alias python=/usr/local/bin/python3 I managed to revert so that when I type python [something], my system uses the python located there (not the newly created one). It seems that it's not as straightforward to get pip to do the same though. pip install some-library just installs stuff for the wrong python version.

How can one make pip install some-library install some-library to the python version located in /usr/local/bin/python3?

Henrik
  • 673
  • 8
  • 18
  • 1
    Have you tried `/usr/local/bin/python3 -m pip some-library` ? – Philippe Mar 07 '21 at 15:37
  • @Philippe should be write. `/python -m pip` is the way to go. In windows this is also what you should do if you want to update pip without provoking an error message: `/python -m pip install -U pip` – gelonida Mar 07 '21 at 16:17
  • Yeah, @Philippe, that works, but I want to be able to use the shorter "pip install some-library" command instead. =) – Henrik Mar 07 '21 at 18:55
  • Then you need to identify the `pip` which goes with `/usr/local/bin/python3`. maybe `/usr/local/bin/pip3` or `/usr/local/bin/pip` – Philippe Mar 07 '21 at 19:04
  • @Philippe, what do you mean? both pip and pip3 points to the python 3.8 version located in: /Users/Henrik/opt/miniconda3/lib/python3.8/site-packages/pip (python 3.8) – Henrik Mar 13 '21 at 06:56

2 Answers2

0

You can try pip3 install some-library for python 3. I hope that works fine!

Shubhang Gupta
  • 128
  • 2
  • 10
0

I think I figured it out.

In /usr/local/bin, I put an alias named "pip" that points to /Library/Frameworks/Python.framework/Versions/3.6/bin/pip3.6

Then i ran the following in terminal:

conda config --set auto_activate_base false

It seems conda kept resetting this whenever I opened terminal. Inspiration from this thread: How do I prevent Conda from activating the base environment by default?

Henrik
  • 673
  • 8
  • 18