【菜鸟飞】在vsCode中安装python的ollama包出错的问题

问题:

在vsCode中安装python的ollama包,执行命令

pip install ollama

 遇到错误:

ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
ollama-python 0.1.2 requires requests<3.0.0,>=2.31.0, which is not installed.
ollama-python 0.1.2 requires httpx<0.27.0,>=0.26.0, but you have httpx 0.28.1 which is incompatible.

 就是这样:

然后尝试命令pip install httpx==0.26.0后,又不符合ollama对httpx的版本要求,所以这个httpx不是和ollama-python版本冲突就是和ollama版本冲突,最终卸载重来,包括捣乱的ollama-python:

pip uninstall ollama
pip uninstall ollama-python

然后再安装ollama,就通过了