简体   繁体   English

如何使用Conda安装scikit-multilearn

[英]How to install scikit-multilearn using Conda

To install scikit-multilearn, I have tried the following commands with no luck: 要安装scikit-multilearn,我已经尝试了以下命令而没有运气:

conda install scikit-multilearn

or, 要么,

conda install -c condo-forge scikit-multilearn

The official website of scikit-multilearn propose using pip: scikit-multilearn的官方网站建议使用pip:

pip install scikit-multilearn

How should I install a python package when I don't find it on Anaconda repository? 当我在Anaconda存储库中找不到它时,我该如何安装python包? Would it be OK if I use pip occasionally, while my default package manager is conda? 如果我偶尔使用pip,而我的默认包管理器是conda,那会没关系吗?

It's fine for you to use pip along with conda. 你可以和pda一起使用pip。 It's made to work this way. 它以这种方式工作。 You have to be aware that not every package is on conda but only on pip. 你必须要知道,不是每个包都在conda上,而只是在pip上。 If you do conda env export > environment.yml , you will see that there is a mix of conda packages and pip. 如果你做conda env export > environment.yml ,你会发现conda包和pip混合在一起。

I eventually installed scikit-multilearn using pip: 我最终使用pip安装了scikit-multilearn:

pip install scikit-multilearn

However, I got the following import error while trying to import it: 但是,尝试导入时出现以下导入错误:

ImportError: No module named builtins ImportError:没有名为builtins的模块

To solve this, I upgraded the future package: 为了解决这个问题,我升级了未来的套餐:

$pip install future --upgrade

Then, I successfully imported scikit-multilearn. 然后,我成功导入了scikit-multilearn。

How should I install a python package when I don't find it on Anaconda repository? 当我在Anaconda存储库中找不到它时,我该如何安装python包?

pip install <package-name>

Would it be OK if I use pip occasionally, while my default package manager is conda? 如果我偶尔使用pip,而我的默认包管理器是conda,那会没关系吗?

Yes, it is totally fine. 是的,完全没问题。 When you use import, the package will be found irrespective of the means of installation; 使用导入时,无论安装方式如何,都会找到包裹; conda or pip. conda或pip。

If you want to install a package for future use, or for more than a single project, you might want to install it into the root environment. 如果要安装软件包以供将来使用,或者要安装多个项目,则可能需要将其安装到根环境中。 This will allow you to import the package any time. 这将允许您随时导入包。 If you are using it for a specific project, and probably just once, create a new virtual environment, install the required packages in that environment and run your code within it. 如果您将它用于特定项目,并且可能只使用一次,则创建一个新的虚拟环境,在该环境中安装所需的包并在其中运行您的代码。

Creating a virtual environment: Link 创建虚拟环境: 链接

The mentioned command 提到的命令

conda install scikit-multilearn conda安装scikit-multilearn

is correct and has a successful result, if Anaconda has already installed. 如果已经安装了Anaconda,那么是正确的并且取得了成功。

You can effectively install scikit-multilearn in a Conda environment using PIP doing this 您可以使用PIP在Conda环境中有效地安装scikit-multilearn

import sys

! {sys.executable} -m pip install scikit-multilearn

! {sys.executable} -m pip install arff

I installed and tested it in a Jupyter Notebook by Anaconda 我在Anaconda的Jupyter笔记本中安装并测试了它

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

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