简体   繁体   中英

how to not install package with pip to anaconda

I have problem about pip.

When I want to install some package, for instance flask, It wants to install it to /anaconda3.

juldou@juldou-machine:~$ pip install flask
Requirement already satisfied (use --upgrade to upgrade): flask in ./anaconda3/lib/python3.5/site-packages

I know that I already have flask, but I don't want install it to anaconda.

How to exit pip of anaconda and set other environment, or what to do with it? Sorry, but I don't understand basics of concept.

The command pip belongs to whatever python environment it was installed in. The exact binary that is executed when you run a command are determined by your PATH environment variable and whatever executable is found first is executed. In your case your Anaconda environment is in your PATH before your system python. If you have a virtualenv or conda sub-environment and want to use executables from those, then "activating" those environments should make those available.

So your choice is to either specify the full path to pip and python and whatever executables you want to run from your non-anaconda environment:

/path/to/my_other_env/bin/pip install flask

Or to not add Anaconda to your PATH (most likely in your .bashrc or .bash_profile) or to prepend your PATH with the path to your non-anaconda's bin directory:

export PATH=/path/to/my_other_env/bin:$PATH
pip install flask

However, doing this will break your normal workflow with Anaconda so things like the following probably won't work anymore:

source activate <conda-env>

If you removed Anaconda from your PATH entirely then you also won't be able to find the conda command without specifying the full path to it:

/path/to/anaconda/bin/conda update ...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM