{"id":10020685,"date":"2025-03-25T22:40:06","date_gmt":"2025-03-25T14:40:06","guid":{"rendered":"https:\/\/itmax.cn\/?p=10020685"},"modified":"2025-03-25T22:40:06","modified_gmt":"2025-03-25T14:40:06","slug":"2025%ef%bc%8c%e5%9c%a8-linux-%e4%b8%8a%e5%ae%89%e8%a3%85-pipenv-%e7%9a%84%e6%ad%a3%e7%a1%ae%e5%a7%bf%e5%8a%bf%ef%bc%8c%e9%81%bf%e5%85%8d%e4%bd%8e%e7%89%88%e6%9c%ac%e5%92%8c%e4%be%9d%e8%b5%96%e5%86%b2","status":"publish","type":"post","link":"https:\/\/itmax.cn\/?p=10020685","title":{"rendered":"2025\uff0c\u5728 linux \u4e0a\u5b89\u88c5 pipenv \u7684\u6b63\u786e\u59ff\u52bf\uff0c\u907f\u514d\u4f4e\u7248\u672c\u548c\u4f9d\u8d56\u51b2\u7a81"},"content":{"rendered":"<p>2025\uff0c\u5728 linux \u4e0a\u5b89\u88c5 pipenv \u7684\u6b63\u786e\u59ff\u52bf\uff0c\u907f\u514d\u4f4e\u7248\u672c pipenv \u548c\u9ad8\u7248\u672c cpython \u517c\u5bb9\u62a5\u9519<\/p>\n<p>\u4e4b\u524d\u5728 linux\uff08\u6bd4\u5982 debian11\u3001ubuntu22 \u8fd9\u4e9b\u53d1\u884c\u7248\uff09\u5b89\u88c5 pipenv \u6709\u4e24\u79cd\u65b9\u5f0f<\/p>\n<p>\u7b2c\u4e00\u79cd\u65b9\u5f0f\uff1a<code>apt install python3-pipenv<\/code> \u5229\u7528 debian \u7cfb\u7684 apt \u5305\u7ba1\u7406\u5668\u5b89\u88c5 pipenv\uff0c\u4f46\u662f\u8fd9\u6837\u4f1a\u6709\u4e00\u4e2a\u95ee\u9898\uff0c\u5c31\u662f pipenv \u7684\u7248\u672c\u4f1a\u975e\u5e38\u7684\u6ede\u540e\uff0c\u548c\u53d1\u884c\u7248\u81ea\u5e26\u7684 cpython \u7248\u672c\u517c\u5bb9\u662f\u6ca1\u6709\u95ee\u9898\uff0c\u4f46\u662f\u5982\u679c\u4f60\u5b89\u88c5\u4e86\u989d\u5916\u7684 cpython \uff0c\u5c24\u5176\u662f\u66f4\u52a0\u65b0\u7248\u672c\u7684 cpython \uff08\u6bd4\u5982\u7cfb\u7edf\u81ea\u5e26\u7684\u662f cpython3.10\uff0c\u4f60\u81ea\u5df1\u7f16\u8bd1\u5b89\u88c5\u4e86\u4e00\u4e2a cpython3.12\uff0c\u8fd9\u4e2a\u65f6\u5019\uff0c\u60f3\u7528 apt \u5b89\u88c5\u7684\u65e7 pipenv \u4e3a cpython3.12 \u521b\u5efa\u865a\u62df\u73af\u5883\u51e0\u4e4e\u662f 100% \u62a5\u9519\u5931\u8d25\uff09<\/p>\n<p>\u7b2c\u4e8c\u79cd\u65b9\u5f0f\uff1a<code>pip3 install pipenv<\/code> \u5229\u7528\u7cfb\u7edf\u4e0a\u7684\u7cfb\u7edf\u7684 pip \u547d\u4ee4\uff0c\u5b89\u88c5\u4e00\u4e2a pipenv\uff0c\u8fd9\u6837\u53ef\u4ee5\u907f\u514d\u4e0a\u9762\u7684\u65e7\u7248\u672c pipenv \u7684\u95ee\u9898\uff0c\u4f46\u662f\u73b0\u5728\u8f83\u65b0\u7684 linux \u53d1\u884c\u7248\uff0c\u90fd\u7981\u6b62\u4f7f\u7528\u7cfb\u7edf\u7684 pip \u76f4\u63a5\u5b89\u88c5\u7b2c\u4e09\u65b9\u547d\u4ee4\u4e86\uff08\u4e3a\u4e86\u907f\u514d\u641e\u4e71\u7cfb\u7edf\u7684\u4f9d\u8d56\uff09\u5177\u4f53\u53ef\u770b\uff1a<a href=\"https:\/\/segmentfault.com\/q\/1010000044672990\/a-1020000044676165\" target=\"_blank\" rel=\"noopener noreferrer\">\u5982\u4f55\u7a81\u7834 debian12 \u5bf9\u4e8e\u7cfb\u7edf\u7684 pip \u5b89\u88c5\u7b2c\u4e09\u65b9\u5305\u7684\u9650\u5236\uff1f<\/a><\/p>\n<p>\u5728 debian12 \u4e2d\uff0c\u76f4\u63a5\u4f7f\u7528 pip \u5b89\u88c5 pipenv \u4f1a\u62a5\u9519\u5982\u4e0b\u2b07\ufe0f<\/p>\n<pre><code class=\"log\">root@720338de0393:\/# pip install pipenv\nerror: externally-managed-environment\n\n\u00d7 This environment is externally managed\n\u2570\u2500&gt; To install Python packages system-wide, try apt install\n    python3-xyz, where xyz is the package you are trying to\n    install.\n    \n    If you wish to install a non-Debian-packaged Python package,\n    create a virtual environment using python3 -m venv path\/to\/venv.\n    Then use path\/to\/venv\/bin\/python and path\/to\/venv\/bin\/pip. Make\n    sure you have python3-full installed.\n    \n    If you wish to install a non-Debian packaged Python application,\n    it may be easiest to use pipx install xyz, which will manage a\n    virtual environment for you. Make sure you have pipx installed.\n    \n    See \/usr\/share\/doc\/python3.12\/README.venv for more information.\n\nnote: 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.\nhint: See PEP 668 for the detailed specification.<\/code><\/pre>\n<p>\u6240\u4ee5\u6211\u4eec\u8981\u600e\u4e48\u5b89\u88c5 pipenv \u5462\uff1f\u6211\u5efa\u8bae\u4f7f\u7528 pipx<\/p>\n<pre><code class=\"shell\">apt install pipx<\/code><\/pre>\n<p>pipx \u7684\u5b50\u547d\u4ee4\u7528\u6cd5\u548c pip \u5dee\u4e0d\u591a<\/p>\n<p>\u8981\u5b89\u88c5 pipenv \u5c31\u76f4\u63a5 <code>pipx install pipenv<\/code> \u5373\u53ef<\/p>\n<pre><code class=\"shell\">root@720338de0393:\/# pipx install pipenv\n  installed package pipenv 2024.4.1, installed using Python 3.12.3\n  These apps are now globally available\n    - pipenv\n    - pipenv-resolver\n\u26a0\ufe0f  Note: '\/root\/.local\/bin' is not on your PATH environment variable. These apps will not be globally accessible until your PATH is updated. Run `pipx ensurepath` to automatically add it, or manually modify your PATH in your shell's config file (i.e. ~\/.bashrc).\ndone! \u2728 \ud83c\udf1f \u2728<\/code><\/pre>\n<p>\u26a0\ufe0f \u6ce8\u610f\u8f93\u51fa\u4e2d\u63d0\u5230\u7684 PATH \u73af\u5883\u53d8\u91cf\u7684\u95ee\u9898<\/p>\n<p><a href=\"https:\/\/segmentfault.com\/a\/1190000046369666\">https:\/\/segmentfault.com\/a\/1190000046369666<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>2025\uff0c\u5728 linux \u4e0a\u5b89\u88c5 pipenv \u7684\u6b63\u786e\u59ff\u52bf\uff0c\u907f\u514d\u4f4e\u7248\u672c pipenv \u548c\u9ad8\u7248\u672c cpython [&hellip;]<\/p>\n","protected":false},"author":8,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[4],"tags":[],"class_list":["post-10020685","post","type-post","status-publish","format-standard","hentry","category-share"],"jetpack_sharing_enabled":true,"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/itmax.cn\/index.php?rest_route=\/wp\/v2\/posts\/10020685","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/itmax.cn\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/itmax.cn\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/itmax.cn\/index.php?rest_route=\/wp\/v2\/users\/8"}],"replies":[{"embeddable":true,"href":"https:\/\/itmax.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=10020685"}],"version-history":[{"count":0,"href":"https:\/\/itmax.cn\/index.php?rest_route=\/wp\/v2\/posts\/10020685\/revisions"}],"wp:attachment":[{"href":"https:\/\/itmax.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=10020685"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/itmax.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=10020685"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/itmax.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=10020685"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}