[英]Transfer Pip packages to conda
I am currently using a shared Ubuntu machine which has python2.7 and multiple packages installed via pip .我目前正在使用一台共享的 Ubuntu 机器,它有python2.7和通过pip安装的多个包。
$ python --version
Python 2.7.12
$ pip --version
pip 18.0 from /usr/local/lib/python2.7/dist-packages/pip (python 2.7)
$ pip list
Package Version
---------------------------------- -----------
asn1crypto 0.24.0
awscli 1.11.101
backports-abc 0.5
...
..
.
I want to install conda
and have Python 2.7
and Python 3.6
environment.我想安装
conda
并拥有Python 2.7
和Python 3.6
环境。
How can I install all the packages currently installed ( pip list
) in both conda env ( 2.7
and 3.6
) ?如何在 conda env(
2.7
和3.6
)中安装当前安装的所有软件包( pip list
)? I am not concerned with package version.我不关心包版本。 Fine to install the same version or latest version for each package.
可以为每个包安装相同版本或最新版本。
First, get a list of packages installed via pip into a file:首先,获取通过 pip 安装的软件包列表到一个文件中:
pip freeze > packages.txt
Then install them using conda inside your two environments:然后在你的两个环境中使用 conda 安装它们:
conda install --yes --file packages.txt
pip freeze
will spit out packages with versions. pip freeze
会输出带有版本的包。 To remove them, run this instead:要删除它们,请改为运行:
pip freeze | sed s/=.*// > packages.txt
This way you will more likely succeed in installing them using conda without getting dependency conflicts.通过这种方式,您更有可能成功地使用 conda 安装它们而不会出现依赖项冲突。
PackagesNotFoundError
PackagesNotFoundError
If you have a lot of packages installed, conda might fail to find some of them.如果您安装了很多软件包,conda 可能无法找到其中的一些。 In that case, check out this question .
在这种情况下,请查看此问题。
Downloading conda and installing multiple python versions are given here and also you can find many important commands related to conda.这里给出了下载conda和安装多个python版本,您还可以找到许多与conda相关的重要命令。 https://github.com/Nitish1206/conda_setup_for_ubuntu
https://github.com/Nitish1206/conda_setup_for_ubuntu
Install pip packages in conda via.通过在 conda 中安装 pip 包。
*while read requirement; conda install --yes $requirement;or pip install $requirement; end < requirements.txt*
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.