Debian 12 中使用 Python 3 创建 venv 虚拟环境
错误提示
简要概述方法
对于当前的 Debian 12 bookworm,可以通过 more /usr/share/doc/python3.11/README.venv
查看 venv 的使用方法
激活虚拟环境,确保指向正确的 Python 解释器路径
虚拟环境中使用 deactivate 可以退出虚拟环境
参考资料:https://docs.python.org/zh-cn/3/library/venv.html
#踩坑笔记@zhanzhangck #Python
Debian 12 bookworm 中的 Python 使用 Python 3.11+,会默认提示用户需要在 venv 虚拟环境后安装 Python 应用程式和库模块,而不是直接在系统(外部)范围内通过 pip 安装相关库模块
如果你仍希望像以前一样直接在系统范围内安装库模块,则需要安装 python3-xyz 即 apt install python3-xyz,此处不再赘述
错误提示
error: externally-managed-environment
× This environment is externally managed
╰─> To install Python packages system-wide, try apt install
python3-xyz, where xyz is the package you are trying to
install.
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. Make
sure 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 a
virtual environment for you. Make sure you have pipx installed.
See /usr/share/doc/python3.11/README.venv for more information.
简要概述方法
对于当前的 Debian 12 bookworm,可以通过 more /usr/share/doc/python3.11/README.venv
查看 venv 的使用方法
#在当前用户的主目录创建 .venvs 虚拟环境目录
mkdir -p ~/.venvs
#用 venvs 创建 MHDDoS 的虚拟环境
python3 -m venv ~/.venvs/Test
#使用虚拟环境中的 Python pip 安装相关库,如下所示
~/.venvs/Test/bin/python -m pip install -r requirements.txt
#查看当前虚拟环境下 pip 安装的库
~/.venvs/Test/bin/python -m pip list
激活虚拟环境,确保指向正确的 Python 解释器路径
source ~/.venvs/Test/bin/activate
虚拟环境中使用 deactivate 可以退出虚拟环境
参考资料:https://docs.python.org/zh-cn/3/library/venv.html
#踩坑笔记@zhanzhangck #Python
Python documentation
venv — Creation of virtual environments
Source code: Lib/venv/ The venv module supports creating lightweight “virtual environments”, each with their own independent set of Python packages installed in their site directories. A virtual en...
Python脚本 一键获取 ChatGpt 的 Access Token,Cursor Pro 自动保活
Python脚本 一键获取 ChatGpt 的 Access Token -- gpt-accesstoken.py
Python脚本 一键获取 Cursor Pro 自动保活 -- cursor_pro_keep_alive.py
项目地址:https://github.com/hmhm2022/gpt-cursor-auto
标签: #github项目推荐 #AI #python@zhanzhangck
GitHub
GitHub - hmhm2022/gpt-cursor-auto: Python脚本 一键获取 ChatGpt 的 Access Token,Cursor Pro 自动保活
Python脚本 一键获取 ChatGpt 的 Access Token,Cursor Pro 自动保活 - hmhm2022/gpt-cursor-auto
Please open Telegram to view this post
VIEW IN TELEGRAM
逛Gaythub刷到两个漫画下载的,群里挺多做漫画的,不知道有没有需求🤩
🧩 bzmh-downloader — Python 脚本,轻松下载「包子漫画」,支持 PDF / CBZ 格式。
🔗 https://github.com/dddinmx/bzmh-downloader
🧩 mxs-downloader — Python 脚本,批量抓取「漫小肆(mxs12.cc)」漫画,多线程极速下载并自动打包 ZIP。
🔗 https://github.com/dddinmx/mxs-downloader
#Python #漫画下载 #自动化
🧩 bzmh-downloader — Python 脚本,轻松下载「包子漫画」,支持 PDF / CBZ 格式。
🔗 https://github.com/dddinmx/bzmh-downloader
🧩 mxs-downloader — Python 脚本,批量抓取「漫小肆(mxs12.cc)」漫画,多线程极速下载并自动打包 ZIP。
🔗 https://github.com/dddinmx/mxs-downloader
#Python #漫画下载 #自动化
Please open Telegram to view this post
VIEW IN TELEGRAM
Please open Telegram to view this post
VIEW IN TELEGRAM
❤1