简体   繁体   English

conda 相当于 pip install

[英]conda equivalent of pip install

If I have a directory with setup.py , in pip , I can pip install .如果我有一个包含setup.py的目录,在pip ,我可以pip install . in the directory to install the package.在安装包的目录中。

What if I am using conda ?如果我使用conda怎么办?

conda install . makes conda to find a package named dot.使conda查找名为 dot 的包。

conda packages are a different structure than standard python packaging. conda包与标准 python 包的结构不同。 As a result, the official, recommended and best-practice approach is to use conda to install pip within an activated conda environment, and use that to install standard packages:因此,官方推荐的最佳实践方法是使用conda在激活的conda环境中安装pip ,并使用它来安装标准包:

conda install pip

NOTE : You want to use conda packages whenever they're available, as they have more features within a conda environment than non- conda packages.注意:您希望在conda包可用时使用它们,因为它们在conda环境中比非conda包具有更多功能。

conda install pip will install pip within the currently activated conda environment, and will ensure that it is integrated with conda so that, for example, conda list , will include any packages installed with pip . conda install pip将在当前激活的conda环境中安装 pip,并确保它与conda集成,例如, conda list将包含任何与pip安装的包。

NOTE : Commands like conda update will ignore pip installed packages, as it only checks conda channels for available updates, so they still need to be updated using pip .注意:像conda update这样的命令将忽略pip安装的软件包,因为它只检查conda channels是否有可用更新,因此它们仍然需要使用pip进行更新。 See this Question/Answer discussion:请参阅此问题/答案讨论:

Does conda update packages from pypi installed using pip install? conda 是否从使用 pip install 安装的 pypi 更新包?

NOTE: See @kalefranz comment below regarding conda 4.6 experimental handling of packages.注意:下面就请看@kalefranz评论conda包4.6实验操作。

If you're interested in creating your own conda package(s), take a look at this question/1st answer for a great run-down:如果您有兴趣创建自己的conda包,请查看这个问题/第一个答案以获得一个很好的总结:

How to install my own python module (package) via conda and watch its changes 如何通过conda安装我自己的python模块(包)并观察它的变化

If you simply wish to install non- conda packages, using pip is the correct, and expected, way to go.如果您只是希望安装非conda软件包,则使用pip是正确且符合预期的方法。

You can use pip install from within conda environment.您可以在conda环境中使用pip install

Just activate your environment using:只需使用以下命令激活您的环境:

$ conda activate myenvironment

and use pip install .并使用pip install . to install your package in environment's directory.将您的软件包安装在环境目录中。

EDIT: As pointed by Chris Larson in another answert, you should install pip inside the environment using编辑:正如Chris Larson在另一个答案中指出的那样,您应该使用

$ conda install pip

in order to register packages correctly.为了正确注册包。

If I have a whl file, I can use pip install xxx.whl to install it.如果我有whl文件,我可以使用pip install xxx.whl来安装它。

From the documentation , conda install from a local file is also available, but the file should be a tarball file, ie .tar.bz2 files.文档中,也可以从本地文件conda install ,但该文件应该是 tarball 文件,即.tar.bz2文件。

conda install /package-path/package-filename.tar.bz2 works. conda install /package-path/package-filename.tar.bz2工作。 And if I have multiple tarballs, I can tar them to get a .tar file, then conda install /packages-path/packages-filename.tar installs the packages in it.如果我有多个 tarball,我可以对它们进行tar以获取.tar文件,然后conda install /packages-path/packages-filename.tar安装其中的包。

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

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