当前位置: 首页 > news >正文

如何在ubuntu下用pip安装aider,解决各种报错问题

aider中文文档网站上给出的安装说明比较简单:

https://aider.doczh.com/docs/install.html

但是在一个干净的ubuntu环境中按文档中的命令安装时,会报错,经过一番尝试之后,解决了报错问题,成功完成了安装。

成功安装执行的命令如下,大家可以直接取用(注意,新版本的ubuntu上默认安装的是python3,而非python,所以下面命令中都是用的python3):

sudo apt install python3-pip python3.12-venvpython3 -m venv myenvsource myenv/bin/activatepip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simplepip install aider-installUV_INDEX_URL=https://pypi.tuna.tsinghua.edu.cn/simple aider-install

下面是问题的解决过程,大家感兴趣的话可以参考一下,不感兴趣可以直接忽略。

按aider中文文档中的说明执行命令:

python3 -m pip install aider-install

报错:

/usr/bin/python3: No module named pip

很明显,是说缺少pip模块。但是用 

sudo apt install python3-pip

命令安装了pip后,运行前面的命令依然报错,这次报的是:

error: externally-managed-environment× This environment is externally managed
╰─> To install Python packages system-wide, try apt installpython3-xyz, where xyz is the package you are trying toinstall.If you wish to install a non-Debian-packaged Python package,create a virtual environment using python3 -m venv path/to/venv.Then use path/to/venv/bin/python and path/to/venv/bin/pip. Makesure you have python3-full installed.If you wish to install a non-Debian packaged Python application,it may be easiest to use pipx install xyz, which will manage avirtual environment for you. Make sure you have pipx installed.See /usr/share/doc/python3.12/README.venv for more information.note: If you believe this is a mistake, please contact your Python installation or OS distribution provider. You can override this, at the risk of breaking your Python installation or OS, by passing --break-system-packages.
hint: See PEP 668 for the detailed specification.

是说需要在虚拟环境中安装python包。

于是执行创建虚拟环境的命令:

python3 -m venv myenv

又报错了:

The virtual environment was not created successfully because ensurepip is not
available.  On Debian/Ubuntu systems, you need to install the python3-venv
package using the following command.apt install python3.12-venvYou may need to use sudo with that command.  After installing the python3-venv
package, recreate your virtual environment.Failing command: /home/teratech/erule-web-3.0/myenv/bin/python3

是说venv模块没有安装,于是再运行

apt install python3.12-venv

命令安装venv。

安装完成后,再次运行

python3 -m venv myenv

命令,虚拟环境创建成功。

然后引用虚拟环境:

source myenv/bin/activate

引用后,命令提示符前出现 (myenv) 标识,说明已经进入了虚拟环境。

更换pip镜像源(重要‼️,否则后续安装aider-install和用aider-install安装aider时会报超时错误):

pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple

这时再执行安装aider的命令:

pip install aider-install

安装 aider-install 成功:

Collecting aider-installDownloading aider_install-0.2.0-py3-none-any.whl.metadata (2.0 kB)
Collecting uv>=0.5.0 (from aider-install)Downloading uv-0.8.15-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (11 kB)
Downloading aider_install-0.2.0-py3-none-any.whl (6.9 kB)
Downloading uv-0.8.15-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (21.0 MB)━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 21.0/21.0 MB 15.5 kB/s eta 0:00:00
Installing collected packages: uv, aider-install
Successfully installed aider-install-0.2.0 uv-0.8.15

然后运行:

UV_INDEX_URL=https://pypi.tuna.tsinghua.edu.cn/simple aider-install

命令,并最终安装成功:

Installed 1 executable: aider

注意:UV_INDEX_URL=https://pypi.tuna.tsinghua.edu.cn/simple 一定要加,因为aider-install命令内部是使用的是uv工具(Ultra-Violet)进行安装,而非直接调用pip。因此即使我们前面已经配置了pip的清华源,该命令仍会使用uv默认的下载通道,导致超时问题。

安装完成后,需要运行一下更新shell的命令:

. ~/.bashrc

来让 .local/bin 目录被加到 PATH 中,从而让 aider 命令能被找到。

更新完shell后,运行 aider 命令,就可以使用aider了:

~$ aider
────────────────────────────────────────────────────────────────────────────────
Aider respects your privacy and never collects your code, chat messages, keys orpersonal info.
For more info: https://aider.chat/docs/more/analytics.html
Allow collection of anonymous analytics to help improve aider? (Y)es/(N)o [Yes]:


文章转载自:

http://ojUZUysF.zLxkp.cn
http://eGp45dN5.zLxkp.cn
http://EmGrj1GO.zLxkp.cn
http://Yci8bI5K.zLxkp.cn
http://sCRPfUkm.zLxkp.cn
http://M6NASkg5.zLxkp.cn
http://2NAJW2VD.zLxkp.cn
http://pHyF3lBH.zLxkp.cn
http://ObjtfjcU.zLxkp.cn
http://sffyQGwR.zLxkp.cn
http://NDwj4dVF.zLxkp.cn
http://cW0c33oH.zLxkp.cn
http://EqJitTRO.zLxkp.cn
http://Xni65miU.zLxkp.cn
http://dqpve6QI.zLxkp.cn
http://d8OR2E3b.zLxkp.cn
http://P6S5XDDa.zLxkp.cn
http://IRJ7d3UY.zLxkp.cn
http://VzOxkkPZ.zLxkp.cn
http://Om5HgT7W.zLxkp.cn
http://ra7f0x6h.zLxkp.cn
http://HjbLQl4B.zLxkp.cn
http://KtuxnkNa.zLxkp.cn
http://t4C15c4F.zLxkp.cn
http://vdeOGXjg.zLxkp.cn
http://ea7iDGns.zLxkp.cn
http://THAxxInV.zLxkp.cn
http://LDeMSg3p.zLxkp.cn
http://MEiYG5wV.zLxkp.cn
http://F1f3umHx.zLxkp.cn
http://www.dtcms.com/a/384361.html

相关文章:

  • Redis 高可用实战源码解析(Sentinel + Cluster 整合应用)
  • 测井曲线解读核心三属性(岩性 / 物性 / 含油气性)实用笔记
  • 【图像理解进阶】VLora参数融合核心原理与Python实现
  • Leetcode 169. 多数元素 哈希计数 / 排序 / 摩尔投票
  • EasyPoi:java导出excel,并从OSS下载附件打包zip,excel中每条记录用超链接关联附件目录
  • Win10系统下载并安装声卡驱动
  • JavaEE初阶——初识计算机是如何工作的:从逻辑门到现代操作系统
  • CKA05--service
  • 信息安全专业毕业设计选题推荐:课题建议与开题指导
  • 【LeetCode 每日一题】1792. 最大平均通过率——贪心 + 优先队列
  • 【深度学习计算机视觉】05:多尺度目标检测
  • Docker将镜像搬移到其他服务上的方法
  • WiseAI-百度研发的AI智能聊天产品
  • .NET驾驭Word之力:理解Word对象模型核心 (Application, Document, Range)
  • 【JAVA接口自动化】JAVA如何读取Yaml文件
  • Redis全面指南:从入门到精通
  • Word在WPS和Office中给图片添加黑色边框
  • C++ Lua组合拳:构建高性能系统配置管理框架
  • 数据库编程--完成简单的信息登录系统+思维导图
  • Spring Boot 深入剖析:SpringApplicationRunListener
  • 【新手指南】解析Laf.run上的GET API接口
  • 如何批量删除 iPhone/iPad 上的照片 [7 种方法
  • Spring Boot 日志体系全面解析:从 SLF4J 到 Logback、Log4j2 与 Lombok 超详细!!
  • springboot创建请求处理
  • 08-Redis 字符串类型全解析:从命令实操到业务场景落地
  • 学习海康VisionMaster之字符缺陷检测
  • CAD画图:002软件界面操作
  • 解锁全球业务潜能:AWS全球网络加速解决方案深度解析
  • HTTPS Everywhere 是什么?HTTPS 插件作用、iOS 抓包失败原因解析与常见抓包工具对比
  • 【C++】STL详解(七)—stack和queue的介绍及使用