lokilindo
lokilindo

Reputation: 702

How to pip install python packages when anaconda is installed?

I installed anaconda and now I can't use pip to install packages on my version 3.6 of python, instead it installs them on anaconda. If I type pip -V I get:

pip 9.0.1 from /anaconda/lib/python3.6/site-packages (python 3.6)

so how do I make it so that it shows:

/Library/Frameworks/Python.framework/Versions/3.6/

instead?. Or am I missing something?

Upvotes: 2

Views: 5133

Answers (2)

mdpt
mdpt

Reputation: 143

Well, anaconda comes with its own python directory, which replaces your default python and thus renders its pip useless. You need to edit .bashrc (or .zshrc in case you are using zsh). There you need to change the path to your original python directory. First of all delete anaconda related export PATH and put in:

export PATH="/Library/Frameworks/Python.framework/Versions/3.6/bin:$PATH"

If you are using Debian based system. You can also try update-alternatives. This is very powerful (yet easy to use) tool, which allows you to change current default python version without manually updating .bashrc. How to use update-alternatives can be found here: https://linuxconfig.org/how-to-change-from-default-to-alternative-python-version-on-debian-linux#h2-change-python-version-system-wide

Upvotes: 1

toonarmycaptain
toonarmycaptain

Reputation: 2331

I had to work this out myself awhile back:

On Windows 10, I entered command prompt (iecmd) and used:

python -m pip install --target=C:\Users\myusername\AppData\Local\Programs\Python\Python36-32\ 

modulename I assume if you can find the folder your python 3.6 then you'll be able to use:

python -m pop install --target=whereever\your\python\is themoduleyouwant

Note that the space between the path and the module name is necessary.

Upvotes: 0

Related Questions