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

Django项目中Pipenv安装mysqlclient时锁定失败求助

安装mysqlclient时Pipenv锁定失败问题

执行的命令

pipenv install mysqlclient

错误信息

Courtesy Notice: Pipenv found itself running within a virtual environment, so it will automatically use that environment, instead of creating its own for any project. You can set PIPENV_IGNORE_VIRTUALENVS=1 to force pipenv to ignore that environment and create its own instead. You can set PIPENV_VERBOSITY=-1 to suppress this warning.
Installing mysqlclient...
Resolving mysqlclient...
Adding mysqlclient to Pipfile's [packages] ...
✔ Installation Succeeded
Pipfile.lock (a01621) out of date, updating to (b35795)...
Locking [packages] dependencies...
Building requirements...
Resolving dependencies...
✘ Locking Failed!
⠹ Locking...
ERROR:pip.subprocessor:[present-rich] Getting requirements to build wheel exited with 1
[ResolutionFailure]:   File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/pipenv/resolver.py", line 811, in _main
[ResolutionFailure]:       resolve_packages(
[ResolutionFailure]:   File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/pipenv/resolver.py", line 759, in resolve_packages
[ResolutionFailure]:       results, resolver = resolve(
[ResolutionFailure]:   File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/pipenv/resolver.py", line 738, in resolve
[ResolutionFailure]:       return resolve_deps(
[ResolutionFailure]:   File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/pipenv/utils/resolver.py", line 1165, in resolve_deps
[ResolutionFailure]:       results, hashes, markers_lookup, resolver, skipped = actually_resolve_deps(
[ResolutionFailure]:   File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/pipenv/utils/resolver.py", line 964, in actually_resolve_deps
[ResolutionFailure]:       resolver.resolve()
[ResolutionFailure]:   File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/pipenv/utils/resolver.py", line 701, in resolve
[ResolutionFailure]:       raise ResolutionFailure(message=str(e))
[pipenv.exceptions.ResolutionFailure]: Warning: Your dependencies could not be resolved. You likely have a mismatch in your sub-dependencies.
  You can use $ pipenv run pip install <requirement_name> to bypass this mechanism, then run $ pipenv graph to inspect the versions actually installed in the virtualenv.
  Hint: try $ pipenv lock --pre if it is a pre-release dependency.
ERROR: Getting requirements to build wheel exited with 1

当前依赖关系图

Courtesy Notice: Pipenv found itself running within a virtual environment, so it will automatically use that environment, instead of creating its own for any project. You can set PIPENV_IGNORE_VIRTUALENVS=1 to force pipenv to ignore that environment and create its own instead. You can set PIPENV_VERBOSITY=-1 to suppress this warning.
django-debug-toolbar==4.1.0
├── django [required: >=3.2.4, installed: 4.2.3]
│   ├── asgiref [required: >=3.6.0,<4, installed: 3.7.2]
│   │   └── typing-extensions [required: >=4, installed: 4.7.1]
│   └── sqlparse [required: >=0.3.1, installed: 0.4.4]
└── sqlparse [required: >=0.2, installed: 0.4.4]
virtualenv==20.23.1
├── distlib [required: >=0.3.6,<1, installed: 0.3.6]
├── filelock [required: >=3.12,<4, installed: 3.12.2]
└── platformdirs [required: >=3.5.1,<4, installed: 3.8.0]

尝试的解决操作及错误

执行以下命令尝试重置锁定:

pipenv lock --pre --clear
rm Pipenv.lock

收到错误提示:

rm: Pipenv.lock: No such file or directory

环境信息

  • 系统:MacOS
  • 编辑器:VS Code
  • Python版本:3.10.5

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.16 19:57:01