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

Conda环境下使用PIP安装facebook-scraper包遭遇ModuleNotFoundError问题求助

ModuleNotFoundError After Installing facebook-scraper in Conda Environment

Let's break down what's going wrong here and fix it step by step:

The Root Cause

Look closely at the warnings from your pip install command—they're pointing to /opt/homebrew/lib/python3.9/site-packages, which is your system Python 3.9's package directory, not the Python 3.8 Conda environment you created.

This means when you ran pip install, you weren't using the pip that belongs to your facebookscraper Conda environment. Instead, you were invoking your system-wide pip, so the package got installed outside your target environment. That's why your IDE (which is using the Conda environment's Python) can't find facebook_scraper.

How to Fix It

Here are the most reliable ways to get the package installed in the right place:

  1. Use python -m pip instead of plain pip
    Activate your Conda environment first, then run:

    python -m pip install facebook-scraper
    

    This forces the command to use the pip associated with the currently active environment's Python interpreter—no chance of accidentally using the system pip.

  2. Verify your pip path first
    Before installing, confirm you're using the correct pip by running:

    which pip
    

    The output should point to your Conda environment's bin directory, like ~/miniconda3/envs/facebookscraper/bin/pip (or the path where your Conda is installed). If it shows /opt/homebrew/bin/pip (system pip), try reactivating your environment or restarting your terminal—sometimes Conda's PATH changes don't take effect immediately.

  3. Reinstall pip in your Conda environment (if needed)
    If the environment's pip is still misbehaving, force a reinstall of pip within the environment:

    conda activate facebookscraper
    conda install pip --force-reinstall
    

    This ensures the environment has its own properly linked pip.

Verify the Installation

After installing, confirm the package is in your environment by running:

pip list | grep facebook-scraper

Or test it directly with Python:

python -c "import facebook_scraper; print('Success! Version:', facebook_scraper.__version__)"

If this runs without errors, your IDE should now be able to import the module correctly.

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.04.27 18:17:50