Jetson Nano安装scikit-learn失败求助(Python3.6.9)
Hey, I’ve dealt with this exact pybind11 header issue when setting up scikit-learn on Jetson devices before. The missing pybind11/pybind11.h is breaking scipy’s compilation, which is a critical dependency for scikit-learn. Here’s how to fix it step by step:
1. Install pybind11 Development Files System-Wide
First, we need to make sure the pybind11 headers are available to the compiler. The easiest way is to install the official system package:
sudo apt-get update sudo apt-get install -y pybind11-dev
This will place the pybind11.h header in a directory the compiler automatically checks.
2. Reinstall scipy (With pybind11 Now Available)
Your previous scipy installation failed mid-compilation, so we need to force a reinstall to ensure it builds correctly this time:
sudo pip3 install -U --force-reinstall scipy
If you prefer using the apt-managed version of scipy instead, you can run:
sudo apt-get install --reinstall -y python3-scipy
3. Retry Installing scikit-learn
Once scipy compiles successfully without errors, you can go back to installing scikit-learn from the git repo:
sudo pip3 install git+https://github.com/scikit-learn/scikit-learn.git
If the System Package Doesn’t Work: Install pybind11 via pip
In rare cases, the apt package might not place headers where the compiler expects them. If that’s the case, install pybind11 directly via pip first:
sudo pip3 install pybind11
Then repeat steps 2 and 3 to reinstall scipy and scikit-learn.
Quick Jetson-Specific Tip
Jetson boards have limited RAM, which can cause compilation timeouts or crashes. If you run into memory issues during the build, temporarily increase your swap space—this often helps get large packages like scipy compiled successfully.
内容的提问来源于stack exchange,提问作者Gold Chicken

