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

ubuntu24.04 python环境

ubuntu24.04 python环境

    • 0.引言
    • 1.使用整理

0.引言

新系统安装依赖库时报错:

pip3installrequirements.txterror:externally−managed−environment×Thisenvironmentisexternallymanaged╰–>ToinstallPythonpackagessystem−wide,tryaptinstallpython3−xyz,wherexyzisthepackageyouaretryingtoinstall.Ifyouwishtoinstallanon−Debian−packagedPythonpackage,createavirtualenvironmentusingpython3−mvenvpath/to/venv.Thenusepath/to/venv/bin/pythonandpath/to/venv/bin/pip.Makesureyouhavepython3−fullinstalled.Ifyouwishtoinstallanon−DebianpackagedPythonapplication,itmaybeeasiesttousepipxinstallxyz,whichwillmanageavirtualenvironmentforyou.Makesureyouhavepipxinstalled.See/usr/share/doc/python3.12/README.venvformoreinformation.note:Ifyoubelievethisisamistake,pleasecontactyourPythoninstallationorOSdistributionprovider.Youcanoverridethis,attheriskofbreakingyourPythoninstallationorOS,bypassing−−break−system−packages.hint:SeePEP668forthedetailedspecification.q@q−pc: /develop/proces

问 gpt:

系统环境被标记为“外部管理环境”,这意味着你不应该直接在这个环境中使用 pip 安装包,因为这可能会破坏系统的稳定性和安全性。Ubuntu 等发行版通常会限制直接在系统 Python 环境中安装包,以避免冲突和不稳定性。

1.使用整理

安装 python3-venv(如果尚未安装):sudo apt install python3-venv

创建虚拟环境:python3 -m venv myenv
激活虚拟环境:source myenv/bin/activate
在虚拟环境中安装依赖:pip3 install -r requirements.txt
退出虚拟环境:deactivate

 source exp_pyenv_39/bin/activate
http://www.lryc.cn/news/494945.html

相关文章:

  • YOLO系列论文综述(从YOLOv1到YOLOv11)【第9篇:YOLOv7——跨尺度特征融合】
  • Elasticearch索引mapping写入、查看、修改
  • 【大模型微调】一些观点的总结和记录
  • Vue 3 Hooks 教程
  • pandas数据处理及其数据可视化的全流程
  • docker 在ubuntu系统安装,以及常用命令,配置阿里云镜像仓库,搭建本地仓库等
  • torch.maximum函数介绍
  • Java面试之多线程并发篇(9)
  • Java全栈:超市购物系统实现
  • 1.1 数据结构的基本概念
  • 深度学习:GPT-2的MindSpore实践
  • 【Oracle11g SQL详解】ORDER BY 子句的排序规则与应用
  • YOLO系列论文综述(从YOLOv1到YOLOv11)【第15篇(完结):讨论和未来展望】
  • Java设计模式 —— 【创建型模式】原型模式(浅拷贝、深拷贝)详解
  • SciAssess——评估大语言模型在科学文献处理中关于模型的记忆、理解和分析能力的基准
  • SQLModel与FastAPI结合:构建用户增删改查接口
  • 【RISC-V CPU debug 专栏 2.3 -- Run Control】
  • 探索 IntelliJ IDEA 中 Spring Boot 运行配置
  • 三除数枚举
  • 【051】基于51单片机温度计【Proteus仿真+Keil程序+报告+原理图】
  • [Java]微服务之服务保护
  • 自动驾驶目标检测融合全貌
  • 消息框(Message Box)的测试方法和测试用例
  • Ubuntu 包管理
  • [Ubuntu] linux之Ubuntu18.04的下载及在虚拟机中详细安装过程(附有下载链接)
  • ffmpeg安装(windows)
  • 服务器数据恢复—raid6阵列硬盘被误重组为raid5阵列的数据恢复案例
  • linux内核编译启动总结
  • Android Studio的AI工具插件使用介绍
  • 本地部署 WireGuard 无需公网 IP 实现异地组网