在Anaconda(Conda)环境中如何跟踪pip-installed软件包? [英] How do I keep track of pip-installed packages in an Anaconda (Conda) environment?
问题描述
我已经安装并使用了 Anaconda Python发行版,我已经开始使用Anaconda(Conda)环境。我可以使用标准的 conda install ...
命令将程序包从配置文件放入我的环境中,但是可以使用外部任何东西(即Flask-WTF,flask-sqlalchemy和alembic)我需要在活动环境中使用 pip install
。但是,当我在目录中查看环境的内容时,或者使用 conda list
这些 pip install
ed包不显示。
I've installed and have been using the Anaconda Python distribution, and I have started using the Anaconda (Conda) environment. I can use the standard conda install...
command to put packages from the distribution into my environments, but to use anything outside (i.e. Flask-WTF, flask-sqlalchemy, and alembic) I need to use pip install
in the active environment. However, when I look at the contents of the environment, either in the directory, or using conda list
these pip install
ed packages don't show up.
使用 pip冻结
和 pip列表
仅列出每个我曾经安装过的包
Using pip freeze
and pip list
just lists every package I've ever installed.
有没有办法跟踪我的每个Anaconda中的内容?code> cv($ pip
和 conda
安装)?
Is there a way to keep track of what is in each of my Anaconda env
s (both pip
and conda
installed)?
推荐答案
conda-env 现在自动执行此操作(如果使用conda安装了pip)。
conda-env now does this automatically (if pip was installed with conda).
您可以使用用于迁移环境的导出工具来了解它的工作原理: p>
You can see how this works by using the export tool used for migrating an environment:
conda env export -n <env-name> > environment.yml
该文件将列出两个conda包和pip包:
The file will list both conda packages and pip packages:
name: stats
channels:
- javascript
dependencies:
- python=3.4
- bokeh=0.9.2
- numpy=1.9.*
- nodejs=0.10.*
- flask
- pip:
- Flask-Testing
如果您希望通过导出环境进行跟踪,请移动 environment.yml
到新的主机,然后运行:
If you're looking to follow through with exporting the environment, move environment.yml
to the new host machine and run:
conda env create -f path/to/environment.yml
这篇关于在Anaconda(Conda)环境中如何跟踪pip-installed软件包?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!