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

求助:执行pip3 -V时报错ModuleNotFoundError: No module named 'pip._internal.cli.main'

Fix for ModuleNotFoundError: No module named 'pip._internal.cli.main' when running pip3 -V

Hey everyone, I recently hit this exact error on my Mac when trying to run pip3 -V, and spent a bit of time troubleshooting it. Let me walk you through the solutions that worked for me, so you don't have to go through the same frustration!

First, let's recap the error for context:

File "/Users/$(whoami)/Library/Python/3.7/bin/pip3", line 5, in from pip._internal.cli.main import main
ModuleNotFoundError: No module named 'pip._internal.cli.main'

This usually happens when your pip installation for Python 3.7 gets corrupted, or the pip script is pointing to a broken/incomplete pip setup. Here are the steps to fix it:

Solution 1: Repair pip using Python's built-in ensurepip

Python comes with a module called ensurepip that can install or repair pip directly. Since you're using Python 3.7, run this command in your terminal:

python3.7 -m ensurepip --upgrade

The --upgrade flag makes sure you get the latest compatible version of pip for your Python 3.7 installation. After running this, try pip3 -V again—this should resolve the missing module error in most cases.

Solution 2: Reinstall pip manually if ensurepip doesn't work

If the first step fails, you can reinstall pip from scratch using the official get-pip script. Here's how:

  1. Download the get-pip.py script compatible with Python 3.7 (note: newer get-pip versions drop support for older Python releases, so we use the 3.7-specific version):
curl https://bootstrap.pypa.io/pip/3.7/get-pip.py -o get-pip.py
  1. Run the script with your Python 3.7 interpreter:
python3.7 get-pip.py

This will overwrite the broken pip installation with a fresh one. Once done, verify with pip3 -V.

Solution 3: Check your pip path (for persistent issues)

If you still see the error, it might be because your terminal is pointing to a broken pip3 executable in ~/Library/Python/3.7/bin/. Let's check:

  1. Find where your pip3 is located:
which pip3
  1. Compare this with the path of your working Python 3.7:
which python3.7

If the pip3 path is in your user Library but the Python 3.7 is in /usr/bin/ or another system path, you might want to either:

  • Delete the broken pip3 script in ~/Library/Python/3.7/bin/
  • Or update your PATH environment variable to prioritize the system Python's pip over the user-local one.

After trying these steps, your pip3 -V command should work normally again!

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.05.11 07:40:29