赞
踩
在虚拟环境中安装 mysqlclient 发生报错:
pipenv install mysqlclient
报错如下:
ERROR:pip.subprocessor:Getting requirements to build wheel exited with 1 [ResolutionFailure]: File "/Users/zhangyongxin/.local/share/virtualenvs/movie-calendar-djapi-VxNe5-yZ/lib/python3.12/site-packages/pipenv/resolver.py", line 645, in _main [ResolutionFailure]: resolve_packages( [ResolutionFailure]: File "/Users/zhangyongxin/.local/share/virtualenvs/movie-calendar-djapi-VxNe5-yZ/lib/python3.12/site-packages/pipenv/resolver.py", line 612, in resolve_packages [ResolutionFailure]: results, resolver = resolve( [ResolutionFailure]: ^^^^^^^^ [ResolutionFailure]: File "/Users/zhangyongxin/.local/share/virtualenvs/movie-calendar-djapi-VxNe5-yZ/lib/python3.12/site-packages/pipenv/resolver.py", line 592, in resolve [ResolutionFailure]: return resolve_deps( [ResolutionFailure]: ^^^^^^^^^^^^^ [ResolutionFailure]: File "/Users/zhangyongxin/.local/share/virtualenvs/movie-calendar-djapi-VxNe5-yZ/lib/python3.12/site-packages/pipenv/utils/resolver.py", line 918, in resolve_deps [ResolutionFailure]: results, hashes, internal_resolver = actually_resolve_deps( [ResolutionFailure]: ^^^^^^^^^^^^^^^^^^^^^^ [ResolutionFailure]: File "/Users/zhangyongxin/.local/share/virtualenvs/movie-calendar-djapi-VxNe5-yZ/lib/python3.12/site-packages/pipenv/utils/resolver.py", line 691, in actually_resolve_deps [ResolutionFailure]: resolver.resolve() [ResolutionFailure]: File "/Users/zhangyongxin/.local/share/virtualenvs/movie-calendar-djapi-VxNe5-yZ/lib/python3.12/site-packages/pipenv/utils/resolver.py", line 448, 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
解决办法如下:
$ # Assume you are activating Python 3 venv
$ brew install mysql pkg-config
$ pip install mysqlclient
如果不想安装 mysql server,只安装 mysql-client 也是可以的:
$ # Assume you are activating Python 3 venv
$ brew install mysql-client pkg-config
$ export PKG_CONFIG_PATH="$(brew --prefix)/opt/mysql-client/lib/pkgconfig"
$ pip install mysqlclient
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。