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

FreeBSD Conda Python3.12下安装GPT4Free(g4f)0.5.7.3版本

FreeBSD下不能直接安装g4f,因为Curl_cffi这个库装不上。0.5.0.3这个版本不需要这个库,所以可以安装。

那么就没有办法安装新版本了吗? 有的,就是在linux仿真环境下。

Linux仿真环境安装g4f

最简单的方法是使用chroot进入linux仿真环境,然后在里面安装新版本的g4f

# 进入linux仿真环境
sudo chroot /compact/ubuntu22 /bin/bash# 启动python环境
source ub22py312/bin/activate 
pip install pip -U
pip install g4f[all] -U
g4f gui

这个方法下成功安装了最新版本的0.5.7.3版本

但是这个方法虽然简单,使用起来却有些繁琐,需要sudo权限

在FreeBSD下安装Conda,然后在Conda环境下安装G4F

更好一点的方法,是直接在FreeBSD下安装Conda,然后在Conda环境下安装G4F

在FreeBSD下安装Conda参考:在FreeBSD14.2下安装MiniConda python3.12 ,以便安装运行Auto-Coder_freebsd conda-CSDN博客

但是现在碰到问题,就是markitdown这个库的新版本无法安装上,进而导致g4f的gui无法启动

解决依赖库markitdown

使用--no-deps

pip install markitdown==0.1.2 --no--deps

解决magika库 

这时候报:No module named 'magika'

pip install magika --no--deps

这时候报: No module named 'onnxruntime'

解决安装onnxruntime库 

发现无法用pip安装onnxruntime

FreeBSD系统里onnxruntime安装包,但是因为没有装在python下,无法用。

FreeBSD系统下还有py311的onnxruntime包,但是因为现在是python3.12环境,也无法用。

用conda命令安装onnxruntime库

conda install onnxruntime

如果速度慢,可以加镜像

创建.condarc文件

conda config --set show_channel_urls yes

在.condarc文件中加入清华镜像

channels:- defaults
show_channel_urls: true
default_channels:- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/r- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/msys2
custom_channels:conda-forge: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloudpytorch: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud

 安装完成,测试g4f

 g4f gui

启动成功!

浏览器浏览的8080端口,网站正常。

结论

关于在FreeBSD系统下使用f4f,如果用完全的仿真,那么很容易安装g4f

如果是conda仿真,那么onnxruntime库可能无法用pip安装,需要使用conda来看着。

调试

用conda安装markitdown的时候,报错RemoveError: 'pluggy'

Verifying transaction: failed                                                         
                                                                                      
RemoveError: 'pluggy' is a dependency of conda and cannot be removed from             
conda's operating environment.                                                        
                                  

pip uninstall pluggy

最终解决见后面隔一个问题。 

删除pluggy后报错conda info could not be constructed.(不应该删除,这步可以跳过)

conda info could not be constructed.
KeyError('active_prefix_name')

An unexpected error has occurred. Conda has prepared the above report.
If you suspect this error is being caused by a malfunctioning plugin,
consider using the --no-plugins option to turn off plugins.
执行

conda --no-plugins install markitdown[all]

不行。不得已,又把pluggy安装上

pip install pluggy

conda装什么都报错RemoveError: 'pluggy'

尝试强制重装核心

conda update conda --force-reinstall  # 强制重装Conda核心组件‌:ml-citation{ref="1,3" data="citationList"}

不行

切换清华源解析

conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/‌:ml-citation{ref="6" data="citationList"}
conda update --all --channel defaults  # 优先使用默认通道‌:ml-citation{ref="5,6" data="citationList"}

哇塞,终于搞定了!

问题的原因,有可能是切换清华源,但没有切换干净.....

http://www.dtcms.com/a/284801.html

相关文章:

  • VR全景园区:开启智慧园区新时代
  • 2025年5大国产ETL工具横向评测
  • 【面板数据】上市公司股价同步性数据集-dta+xlsx(2000-2023年)
  • GX75C数字温度传感器可兼容TMP75C
  • 上标下标 | Unicode 符号
  • 微服务架构:从单体到分布式系统的演进与实践
  • 32位 DMIC 数据 其中高八位为符号位扩展位的理解
  • git merge-base查看某个分支从哪里拉出来的、主main分支上的某个时间之后某人的提交合并到特定分支(使用 cherry-pick 的场景)
  • 研发知识系统选型实战:从 Notion 到 Gitee Wiki 的迭代经验
  • Python中with的作用和用法
  • 前端之HTML学习
  • Python可迭代对象与迭代器详解 - 深入理解Python迭代机制
  • DolphinScheduler 如何高效调度 AnalyticDB on Spark 作业?
  • 【C语言】动态内存管理全解析:malloc、calloc、realloc与free的正确使用
  • AR技术赋能石化巡检:安全高效新引擎
  • linux-SSH
  • 2025年广东食品生产高级证考试题
  • Python特殊方法完全指南 | 掌握魔术方法提升编程能力
  • 性能监控(一)性能监控核心概念、核心指标
  • SGMD辛几何模态分解 直接替换Excel运行包含频谱图相关系数图 Matlab语言!
  • 藏语识别技术:让古老智慧触手可及的AI突破
  • 前缀和题目:表现良好的最长时间段
  • 快慢指针的应用
  • 5种禁止用户复制的实用方案
  • C++网络编程 4.UDP套接字(socket)编程示例程序
  • UNISOC8850平台Log工具使用说明
  • 基于python和neo4j构建知识图谱医药问答系统
  • Cursor开发步骤
  • 大模型狂想曲:当AI学会“思考”,世界如何被重塑?
  • 用aws下载NOAA的MB文件