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

Ubuntu16.04下Python2.7安装Jupyter Notebook时scandir报错(错误码1)

Fixing Scandir Installation Error When Installing Jupyter Notebook on Ubuntu 16.04 (Python 2.7)

I’ve run into this exact issue before on Ubuntu 16.04 with Python 2.7—scandir’s C extension fails to build because of missing system dependencies or incompatible package versions. Here are the practical fixes that worked for me:

1. Install Required Build Dependencies

Scandir is a C-based library, so it needs GCC and Python development headers to compile successfully. Run these commands first to get the necessary tools:

sudo apt-get update
sudo apt-get install build-essential python-dev

Once installed, try re-running the Jupyter installation command:

pip install jupyter

2. Pin Scandir to a Python 2.7-Compatible Version

Newer versions of scandir dropped support for Python 2.7 entirely. Install an older, compatible version explicitly before installing Jupyter:

pip install scandir==1.10.0

Then proceed with the Jupyter install:

pip install jupyter

3. Upgrade Pip to the Last Python 2.7-Supported Version

Outdated pip versions often struggle with resolving dependencies for legacy Python releases. Upgrade pip to the final version that supports Python 2.7 first:

pip install --upgrade pip==20.3.4

After upgrading, retry installing Jupyter.

To avoid messing with system-wide Python packages, create an isolated virtual environment for your Jupyter setup:

sudo apt-get install python-virtualenv
virtualenv jupyter_env
source jupyter_env/bin/activate

Run all the above installation steps inside this activated environment to keep your system clean.

内容的提问来源于stack exchange,提问作者ninghang.mei

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.05.27 04:01:00