Pycharm 选择Python Interpreter

你的系统可能有多个 Python 环境,比如:

macOS 自带的 /usr/bin/python3

你用 brew install python 安装的 /opt/homebrew/bin/python3

你可能还用了虚拟环境(venv 或 conda)

PyCharm 默认配置可能用的是一个虚拟环境,但你用 Terminal 装包时用了另一个

所以你终端里用 pip install 装了包,但 PyCharm 里其实没在用那个 Python。

✅ 解决方案:确认 PyCharm 用的解释器

打开 PyCharm 的设置:

macOS 上是:PyCharm → Preferences → Project: xxx → Python Interpreter

检查当前解释器路径,例如:

swift

复制

编辑

/opt/homebrew/bin/python3.11

/Users/you/project/venv/bin/python

/usr/bin/python3

对比你在终端里执行这个命令的输出:

bash

复制

编辑

which python3

which pip3

看看是不是和 PyCharm 配置的路径一致。

✅ 如果你想统一使用终端里的解释器:

你可以把 PyCharm 的解释器改成终端里那个:

点 Interpreter 设置页面右上角齿轮 → Add...

选择 System Interpreter

选择你在终端用的那个路径(which python3 给你的路径)

点 OK,PyCharm 会重新加载包列表

相关推荐
萌萌站起6 分钟前
Vscode 中 python模块的导入问题
ide·vscode·python
是小蟹呀^20 分钟前
【总结】提示词工程
python·llm·prompt·agent
YBAdvanceFu22 分钟前
从零构建智能体:深入理解 ReAct Plan Solve Reflection 三大经典范式
人工智能·python·机器学习·数据挖掘·多智能体·智能体
王夏奇39 分钟前
python中的__all__ 具体用法
java·前端·python
王夏奇43 分钟前
pycharm中3种不同类型的python文件
ide·python·pycharm
小陈的进阶之路1 小时前
Selenium 滑动 vs Appium 滑动
python·selenium·测试工具·appium
Mike_6661 小时前
txt_json和xml_json
xml·python·json
周周不一样1 小时前
Andorid基础笔记2-jar&反射
笔记·pycharm·jar
zyq99101_12 小时前
DFS算法实战:经典例题代码解析
python·算法·蓝桥杯·深度优先
数据知道2 小时前
claw-code 源码分析:从 TypeScript 心智到 Python/Rust——跨栈移植时类型、边界与错误模型怎么对齐?
python·ai·rust·typescript·claude code·claw code