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.
Most Python packages are now designed to be compatible with Python's pip package manager. But if you have a package that is not compatible with pip, you'll need manually install Python packages.
Both pip and conda are included in Anaconda and Miniconda, so you do not need to install them separately. Conda environments replace virtualenv, so there is no need to activate a virtualenv before using pip. It is possible to have pip installed outside a conda environment or inside a conda environment.
You should install pip inside your conda environment and use pip in that conda environment (only) when conda-formatted packages are not available from the major conda repos (like conda-forge or anaconda.org).
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 ...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With