You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Windows环境下Jupyter中skmultilearn模块导入失败求助

Fixing ModuleNotFoundError: No module named 'skmultilearn' in Jupyter (Windows)

Let’s tackle your issues one by one, starting with the core module not found error since that’s blocking your code execution:

1. Resolve the skmultilearn module issue

The root problem here is almost certainly a mismatch between the Python environment you used to install skmultilearn and the one your Jupyter notebook is running. Here’s how to fix it:

Step 1: Find Jupyter’s active Python path

Open your Jupyter notebook and run this code in a cell:

import sys
print(sys.executable)

This will output the full path to the Python executable your Jupyter kernel is using (e.g., C:\Users\YourName\anaconda3\python.exe or C:\Users\YourName\AppData\Local\Programs\Python\Python311\python.exe).

Step 2: Install skmultilearn to Jupyter’s environment

Open Command Prompt (CMD) on Windows, then run this command—replace <jupyter-python-path> with the path you copied from Step 1:

"<jupyter-python-path>" -m pip install scikit-multilearn

(Note: The official PyPI package name is scikit-multilearn, even though you import it as skmultilearn in your code.)

If you’re using a virtual environment, make sure Jupyter recognizes it:

  • Activate your virtual environment in CMD (e.g., venv\Scripts\activate for a standard venv)
  • Install the ipykernel package to link the environment to Jupyter:
    pip install ipykernel
    
  • Register the environment as a Jupyter kernel:
    python -m ipykernel install --user --name=your-env-name --display-name="Python (your-env-name)"
    
  • Restart Jupyter, then switch to this new kernel via the Kernel > Change kernel menu before running your code.

2. Troubleshoot the stuck git clone

For the git clone issue in your Jupyter directory:

  • First confirm Jupyter’s working directory by running this in a notebook cell:
    import os
    print(os.getcwd())
    
  • Open CMD, navigate to that directory with cd "<jupyter-working-directory>", then run your git clone <repository-url> command directly here.
  • If it still fails, check:
    • Your internet connection (can you access the git repository in a browser?)
    • Directory permissions (try running CMD as Administrator if you get access denied errors)
    • Git is properly installed (run git --version in CMD to verify)

Your original error for reference:

in ()
5 return_indicator = 'sparse', allow_unlabeled = False)
6 ----> 7 from skmultilearn.adapt import MLkNN
8
9 classifier = MLkNN(k=20)
ModuleNotFoundError: No module named 'skmultilearn'

内容的提问来源于stack exchange,提问作者capncook

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.26 09:25:21