简体   繁体   English

如何不用pip安装包到anaconda

[英]how to not install package with pip to anaconda

I have problem about pip. 我有关于pip的问题。

When I want to install some package, for instance flask, It wants to install it to /anaconda3. 当我想安装一些软件包时,例如flask,它想要将它安装到/ 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. 我知道我已经有烧瓶,但我不想把它安装到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. 命令pip属于它所安装的任何python环境。运行命令时执行的确切二进制文件由PATH环境变量确定,并且执行先找到的任何可执行文件。 In your case your Anaconda environment is in your PATH before your system python. 在您的情况下,您的Anaconda环境在您的系统python之前就在您的PATH中。 If you have a virtualenv or conda sub-environment and want to use executables from those, then "activating" those environments should make those available. 如果您有virtualenv或conda子环境并且想要使用那些可执行文件,那么“激活”这些环境应该使这些可用。

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: 因此,您可以选择指定pippython的完整路径以及要从非anaconda环境运行的任何可执行文件:

/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: 或者不将Anaconda添加到PATH(最有可能是.bashrc或.bash_profile)或者将PATH添加到非anaconda的bin目录的路径:

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: 但是,这样做会破坏您使用Anaconda的正常工作流程,因此以下内容可能不再适用:

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中删除了Anaconda,那么在没有指定完整路径的情况下,您也将无法找到conda命令:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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