{"id":6329,"date":"2021-03-17T22:25:57","date_gmt":"2021-03-17T14:25:57","guid":{"rendered":"https:\/\/vip.fxxkpython.com\/?p=6329"},"modified":"2021-03-17T22:32:36","modified_gmt":"2021-03-17T14:32:36","slug":"%e4%b8%8d-pip-install%ef%bc%8c%e4%bd%a0%e5%85%bb%e6%88%91%e5%90%97%ef%bc%9f","status":"publish","type":"post","link":"https:\/\/vip.fxxkpython.com\/?p=6329","title":{"rendered":"\u4e0d pip install\uff0c\u4f60\u517b\u6211\u5417\uff1f"},"content":{"rendered":"\n<p>\u200b\u6211\u4eec\u5728\u5f00\u53d1 Python \u9879\u76ee\u7684\u65f6\u5019\uff0c\u6211\u4eec\u603b\u4f1a\u4f7f\u7528\u5230\u8fd9\u4e48\u51e0\u4e2a\u73a9\u610f\uff1a<\/p>\n\n\n\n<blockquote class=\"wp-block-quote\"><p>pip <\/p><p>requirements.txt<\/p><p> vent<\/p><\/blockquote>\n\n\n\n<p>\u5f53\u4f60\u521b\u5efa\u4e00\u4e2a Python \u9879\u76ee\u7684\u65f6\u5019\uff0c\u4f60\u4f1a\u5148\u6574\u4e00\u4e2a\u865a\u62df\u73af\u5883\uff08virtualenv\uff09\uff0c\u5728\u8fd9\u91cc\u9762\u4f7f\u7528\u5230\u7684\u7b2c\u4e09\u65b9\u6a21\u5757\uff0c\u7248\u672c\u7b49\uff0c\u90fd\u53ea\u4f5c\u7528\u4e8e\u4f60\u8fd9\u4e2a\u9879\u76ee\u5f53\u524d\u7684\u73af\u5883\uff0c\u548c\u5176\u4ed6\u7684\u9879\u76ee\u4e92\u4e0d\u5e72\u6270\u3002<\/p>\n\n\n\n<p>\u6bd4\u5982\uff0c\u4f60\u53ef\u4ee5\u521b\u5efa\u4e00\u4e2a Python3 \u7684\u865a\u62df\u73af\u5883\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/pic4.zhimg.com\/v2-26c4a7051eb2c8d9d16ff5bbf3926aeb_b.png\" alt=\"\"\/><\/figure>\n\n\n\n<p>\u73b0\u5728\uff0c\u4f60\u7684 Python \u9879\u76ee\u300cmy_project\u300d\u5c31\u62e5\u6709\u4e86\u81ea\u5df1\u7684 Python3 \u73af\u5883\uff0c\u4f60\u53ef\u4ee5\u5728\u8fd9\u91cc\u9762\u4e3a\u6240\u6b32\u4e3a\uff0c\u8fd9\u6837\u597d\u5904\u662f\uff0c\u5728\u8fd9\u91cc\u9762\u6240\u6709\u7684\u64cd\u4f5c\u90fd\u4e0d\u4f1a\u548c\u5916\u754c\u4ea7\u751f\u4e0d\u5fc5\u8981\u7684\u9ebb\u70e6\uff0c\u6bd4\u5982\u4f60\u5728\u8fd9\u91cc\u4f7f\u7528 pip \u5b89\u88c5\u7684\u6a21\u5757\uff0c\u5c31\u662f\u53ea\u4f5c\u7528\u4e8e\u8fd9\u4e2a\u73af\u5883\u4e2d\u7684\uff0c\u4e0d\u4f1a\u548c\u4f60\u7684\u7cfb\u7edf\u641e\u5f97\u4e71\u4e03\u516b\u7cdf\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/pic2.zhimg.com\/v2-7d3d5f1df4f80bff8393aac457ef4339_b.png\" alt=\"\"\/><\/figure>\n\n\n\n<p>\u5f53\u4f60\u9879\u76ee\u5f00\u53d1\u5b8c\u6210\uff0c\u60f3\u8981\u7ed9\u522b\u4eba\u4f7f\u7528\uff0c\u6216\u8005\u5728\u751f\u4ea7\u73af\u5883\u4e2d\u8fd0\u884c\u65f6\uff0c\u4f60\u53ef\u4ee5\u4f7f\u7528 pip \u5c06\u9879\u76ee\u4e2d\u4f7f\u7528\u5230\u7684\u5e93\u751f\u6210\u4e00\u4e2a \u300crequirements.txt\u300d\u6587\u4ef6\uff1a<\/p>\n\n\n\n<blockquote class=\"wp-block-quote\"><p>pip freeze > requirements.txt<\/p><\/blockquote>\n\n\n\n<p>\u8fd9\u65f6\u5019\u4f60\u5f53\u524d\u9879\u76ee\u4e0b\u4f1a\u751f\u6210\u4e00\u4e2a requirements.txt \u6587\u4ef6\uff0c\u8fd9\u91cc\u9762\u5217\u51fa\u6765\u7684\u5c31\u662f\u4f60\u8fd9\u4e2a\u9879\u76ee\u7528\u5230\u7684\u5e93\u4ee5\u53ca\u76f8\u5173\u7684\u7248\u672c\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/pic3.zhimg.com\/v2-888004302cf60a3fee1e6bcce31bd282_b.png\" alt=\"\"\/><\/figure>\n\n\n\n<p>\u90a3\u4e48\uff0c\u5f53\u522b\u4eba\u8981\u4f7f\u7528\u4f60\u8fd9\u4e2a\u9879\u76ee\u7684\u65f6\u5019\uff0c\u53ea\u9700\u8981\u4f7f\u7528\u5982\u4e0b\u547d\u4ee4\u5c31\u53ef\u4ee5\u5b89\u88c5\u4f60\u8fd9\u4e2a\u9879\u76ee\u4e2d\u6240\u6709\u4f9d\u8d56\u7684\u5e93\uff1a<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre class=\"CodeMirror\" data-setting=\"{&quot;showPanel&quot;:true,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;python&quot;,&quot;mime&quot;:&quot;text\/x-python&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:false,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;wpum_restrict_type&quot;:&quot;wpum_restrict_type_state&quot;,&quot;wpum_hide_state_in&quot;:false,&quot;wpum_hide_state_out&quot;:false,&quot;language&quot;:&quot;Python&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;python&quot;}\">pip install -r requirements.txt<\/pre><\/div>\n\n\n\n<p>\u4f46\u662f\uff0c\u7ecf\u8fc7\u4e00\u6bb5\u65f6\u95f4\u4f1a\u53d1\u73b0\uff0c\u4f60\u9700\u8981\u7ecf\u5e38\u53bb\u4fee\u6539 \u300crequirements.txt\u300d\u4e2d\u7684\u5185\u5bb9\u624d\u80fd\u8ba9\u5f00\u53d1\u73af\u5883\u548c\u751f\u4ea7\u73af\u5883\u76f8\u4e00\u81f4\uff0c\u6bd4\u5982\u8bf4\uff0c\u4f60\u5728\u4f60\u7684\u9879\u76ee\u4e2d\u5f15\u7528\u4e86\u4e24\u4e2a\u7b2c\u4e09\u65b9\u5e93\uff0c\u800c\u5b83\u4eec\u53c8\u5f15\u7528\u4e86\u76f8\u540c\u7684\u5e93\uff0c\u4f46\u662f\u7248\u672c\u4e0d\u540c\uff0c\u90a3\u4e48\u5728\u751f\u4ea7\u73af\u5883\u4e2d\u5c31\u53ef\u80fd\u51fa\u95ee\u9898\u3002<\/p>\n\n\n\n<p>\u5047\u8bbe\u4f60\u9879\u76ee\u5f15\u7528\u4e86 \u300crequests\u300d\u548c\u300cclick\u300d\u5e93\uff0c\u800c\u5b83\u4eec\u90fd\u5f15\u7528\u4e86\u4e00\u4e2a\u53eb\u505a\u300c\u5e05b\u300d\u7684\u5e93\u3002\u4f46\u662f\u5b83\u4eec\u4f7f\u7528\u7684\u7248\u672c\u4e0d\u4e00\u6837\uff0c\u6bd4\u5982 \u300crequests\u300d \u7528\u7684\u662f \u300c\u5e05b\u300d1.0 \u7248\u672c\uff1a<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre class=\"CodeMirror\" data-setting=\"{&quot;showPanel&quot;:true,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;python&quot;,&quot;mime&quot;:&quot;text\/x-python&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:false,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;wpum_restrict_type&quot;:&quot;wpum_restrict_type_state&quot;,&quot;wpum_hide_state_in&quot;:false,&quot;wpum_hide_state_out&quot;:false,&quot;language&quot;:&quot;Python&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;python&quot;}\">\u5e05b==1.0<\/pre><\/div>\n\n\n\n<p>\u800c \u300cclick\u300d \u7528\u7684\u662f 2.0 \u7248\u672c<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre class=\"CodeMirror\" data-setting=\"{&quot;showPanel&quot;:true,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;python&quot;,&quot;mime&quot;:&quot;text\/x-python&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:false,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;wpum_restrict_type&quot;:&quot;wpum_restrict_type_state&quot;,&quot;wpum_hide_state_in&quot;:false,&quot;wpum_hide_state_out&quot;:false,&quot;language&quot;:&quot;Python&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;python&quot;}\">\u5e05b==2.0<\/pre><\/div>\n\n\n\n<p>\u8fd9\u65f6\u5019\uff0c\u751f\u4ea7\u73af\u5883\u60f3\u901a\u8fc7 pip install -r requirements.txt \u6765\u5b89\u88c5\u4f9d\u8d56\u5e93\uff0c\u4f46 pip \u53d1\u73b0\u73b0\u5728\u300c\u5e05b\u300d\u7684\u6700\u65b0\u7248\u672c\u662f 3.0\uff0c\u7136\u540e\u76f4\u63a5\u61f5\u903c\u4e86\uff0c\u6211\u7279\u4e48\u5230\u5e95\u8981\u5b89\u88c5\u4e86 \u300c\u5e05b\u300d1.0 \u7248\u672c\u8fd8\u662f 2.0 \u7248\u672c\u8fd8\u662f 3.0 \u7248\u672c\uff1f<\/p>\n\n\n\n<p>pip \u8fd9\u65f6\u5019\u53ea\u80fd\u628a\u5148\u770b\u5230\u7684\u90a3\u4e2a\u5b89\u88c5\u4e00\u6ce2\uff0c\u5148\u628a \u300c\u5e05b==1.0\u300d\u7ed9\u5b89\u88c5\u4e86\uff0c\u7136\u540e\u518d\u5b89\u88c5\u4e00\u4e2a\u6700\u65b0\u7684\u7248\u672c\u300c\u5e05b==3.0\u300d\u3002<\/p>\n\n\n\n<p>\u90a3\u4e48\u73b0\u5728\u751f\u4ea7\u73af\u5883\u662f\u6ca1\u6709\u300c\u5e05b==2.0\u300d\u7248\u672c\u7684\uff0c\u5047\u8bbe click \u5e93\u53ea\u80fd\u7528\u300c\u5e05b2.0\u300d\u4ee5\u4e0b\u7684\u7248\u672c\uff0c\u90a3\u4e48\u8fd9\u65f6\u5019\u5728\u751f\u4ea7\u73af\u5883\u5c31\u7528\u4e0d\u4e86 click \u7684\u529f\u80fd\uff0c\u9879\u76ee\u6251\u8857\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/pic2.zhimg.com\/v2-9795430f8c7cd2602ad73ea67727397d_b.jpg\" alt=\"\"\/><\/figure>\n\n\n\n<p>\u4e8e\u662f\uff0c\u4f60\u9700\u8981\u53bb\u4fee\u6539\u300crequirements.txt\u300d\uff0c\u6bd4\u5982\u6539\u6210\u8fd9\u6837\u89c4\u5b9a\u5b83\u4e0d\u8981\u4e71\u6765\uff1a<\/p>\n\n\n\n<blockquote class=\"wp-block-quote\"><p>\u5e05b>=1.0,&lt;=2.0<\/p><p> requests==2.25.1<\/p><p> click==7.1.2<\/p><p> &#8230;<\/p><\/blockquote>\n\n\n\n<p>\u90a3\u5982\u679c\u6709\u5f88\u591a\u8fd9\u6837\u7684\u60c5\u51b5\uff0c\u5c82\u4e0d\u662f\u5f97\u53eb\u7238\u7238\u4e86\u554a\uff1f<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/pic1.zhimg.com\/v2-18ec3667942125971021241f1d231438_b.jpg\" alt=\"\"\/><\/figure>\n\n\n\n<p>\u6709\u6ca1\u6709\u66f4\u597d\u7684\u4f7f\u7528\u65b9\u5f0f\uff0c\u8ba9 Python \u9879\u76ee\u7684\u5305\u7ba1\u7406\u66f4\u723d\u5462\uff1f<\/p>\n\n\n\n<p><br>\u90a3\u4e48\u63a5\u4e0b\u6765\u5c31\u662f<strong><a href=\"https:\/\/vip.fxxkpython.com\/\">\u5b66\u4e60 Python \u7684\u6b63\u786e\u59ff\u52bf<\/a><\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/pic3.zhimg.com\/v2-b78af880ed9d71ba3a6d46d15e7500ae_b.jpg\" alt=\"\"\/><\/figure>\n\n\n\n<p>\u63a5\u4e0b\u6765\u5c0f\u5e05b\u8981\u7ed9\u4f60\u5206\u4eab\u7684\u662f\uff1a<a href=\"https:\/\/pypi.org\/project\/pipenv\/\">pipenv<\/a>\u3002<\/p>\n\n\n\n<p>\u8fd9\u540d\u5b57\u770b\u8d77\u6765\u662f pip + virtualenv\uff0c\u4e0d\u8fc7 pipenv \u6bd4\u4ed6\u4eec\u66f4\u597d\u7528\uff0c\u5b83\u53ef\u4ee5\u8ba9\u4f60\u7684\u5305\u7ba1\u7406\u66f4\u52a0\u7684\u987a\u6ed1\u9178\u723d\u3002<\/p>\n\n\n\n<p>\u63a5\u4e0b\u6765\u5c0f\u5e05b\u5e26\u4f60\u4f53\u9a8c\u4e00\u6ce2\uff0c\u9996\u5148\u4f60\u5f97\u5148\u5b89\u88c5\u597d pipenv\uff1a<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre class=\"CodeMirror\" data-setting=\"{&quot;showPanel&quot;:true,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;python&quot;,&quot;mime&quot;:&quot;text\/x-python&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:false,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;wpum_restrict_type&quot;:&quot;wpum_restrict_type_state&quot;,&quot;wpum_hide_state_in&quot;:false,&quot;wpum_hide_state_out&quot;:false,&quot;language&quot;:&quot;Python&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;python&quot;}\">pip install pipenv<\/pre><\/div>\n\n\n\n<h2>pipenv \u4f7f\u7528\u865a\u62df\u73af\u5883<\/h2>\n\n\n\n<p>\u73b0\u5728\uff0c\u6211\u4eec\u521b\u5efa\u865a\u62df\u73af\u5883\u662f\u8fd9\u6837\u7684\uff0c\u8fdb\u5165\u4f60\u7684\u9879\u76ee\uff0c\u4f7f\u7528\uff1apipenv install \u4f60\u8fd8\u53ef\u4ee5\u5728 install \u6307\u5b9a\u865a\u62df\u73af\u5883\u4f7f\u7528\u7684 Python \u7248\u672c\uff0c\u6bd4\u5982\u4f7f\u7528 Python 2: pipenv install &#8211;two \u4f7f\u7528 Python 3.9.1 Piping install &#8211;python3.9.1<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/pic2.zhimg.com\/v2-58e7916f41c4a0b16e48eb80f0a06be5_b.png\" alt=\"\"\/><\/figure>\n\n\n\n<p>\u53ef\u4ee5\u770b\u5230\uff0c\u6211\u4eec\u628a\u865a\u62df\u73af\u5883\u521b\u5efa\u597d\u4e86\uff0c\u63a5\u7740\u4f7f\u7528\u5982\u4e0b\u547d\u4ee4\u6765\u6fc0\u6d3b\u865a\u62df\u73af\u5883\uff1apipenv shell\u5f53\u7136\uff0c\u5982\u679c\u4f60\u4e0d\u60f3\u6fc0\u6d3b\u865a\u62df\u73af\u5883\uff0c\u4f46\u662f\u60f3\u76f4\u63a5\u4f7f\u7528\u865a\u62df\u73af\u5883\u7684\u8bdd\uff0c\u53ef\u4ee5\u4f7f\u7528\u5982\u4e0b\u547d\u4ee4\u6765\u8fd0\u884c\uff1apipenv run\u770b\u5230\u8fd9\u91cc\uff0c\u4f60\u53ef\u80fd\u4f1a\u89c9\u5f97\uff0c\u548c\u4e0a\u9762\u7684 venv \u521b\u5efa\u865a\u62df\u73af\u5883\u5dee\u4e0d\u591a\u554a\uff1f<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/pic4.zhimg.com\/v2-c17fcf57c5ae8fa427057bf9b17bc7c7_b.jpg\" alt=\"\"\/><\/figure>\n\n\n\n<p>\u6253\u5f00\u4f60\u7684\u9879\u76ee\u6587\u4ef6\uff0c\u4f60\u53ef\u4ee5\u770b\u5230\uff0c\u5728\u4f7f\u7528 pipenv \u521b\u5efa\u865a\u62df\u73af\u5883\u7684\u65f6\u5019\uff0c\u591a\u51fa\u6765\u4e86\u4e24\u4e2a\u6587\u4ef6\uff1aPipfile \uff0cPipfile.lock\u3002<\/p>\n\n\n\n<p>\u5b83\u4eec\u662f\u5e72\u5565\u7684\u5462\uff1f<\/p>\n\n\n\n<p>\u5176\u5b9e\u5b83\u4eec\u5c31\u662f\u4e3a\u4e86\u89e3\u51b3\u6211\u4eec\u521a\u521a\u8bf4\u7684\u90a3\u4e9b\u5305\u4f9d\u8d56\u7684\u95ee\u9898\u3002\u4e4b\u524d\uff0c\u6211\u4eec\u603b\u662f\u9700\u8981\u5728 requirements.txt \u6587\u4ef6\u4e2d\u6539\u6765\u6539\u53bb\u3002\u800c\u73b0\u5728\u6709\u4e86\u5b83\u4eec\uff0c\u6211\u4eec\u53ef\u4ee5\u8ba9\u5305\u7ba1\u7406\u53d8\u5f97\u5f88\u8212\u670d\u3002<\/p>\n\n\n\n<p>\u4e5f\u5c31\u662f\u8bf4\uff0c\u73b0\u5728\u6211\u4eec\u901a\u8fc7 pipenv \u6765\u64cd\u4f5c\u7b2c\u4e09\u65b9\u5e93\u3002\u4f60\u662f\u5220\u9664\u4e5f\u597d\uff0c\u66f4\u65b0\u4e5f\u7f62\uff0c\u5b83\u4eec\u90fd\u4f1a\u5e2e\u4f60\u81ea\u52a8\u66f4\u65b0\uff0c\u4f60\u4e0d\u7528\u518d\u53bb\u64cd\u5fc3 requirements.txt \u4e86\u3002<\/p>\n\n\n\n<p>\u6bd4\u5982\uff0c\u6211\u4eec\u73b0\u5728\u4f7f\u7528 pipenv \u6765\u5b89\u88c5\u300c<a href=\"https:\/\/requests.readthedocs.io\/en\/master\/\">requests<\/a>\u300d\u548c \u300c<a href=\"https:\/\/click.palletsprojects.com\/en\/7.x\/\">click<\/a>\u300d\u5e93\uff1a<\/p>\n\n\n\n<blockquote class=\"wp-block-quote\"><p>pipenv install requests <\/p><p>pipenv install click<\/p><\/blockquote>\n\n\n\n<p>\u8fd9\u65f6\u5019 pipenv \u4f1a\u81ea\u52a8\u5c06\u4f60\u4f7f\u7528\u7684\u5e93\u66f4\u65b0\u5230 \u300cPipfile\u300d\u548c \u300cPipfile.lock\u300d\u6587\u4ef6\u4e2d\u3002pipfile\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/pic2.zhimg.com\/v2-2be9ae6ea3fa11d379ff5b4fe1d240bd_b.png\" alt=\"\"\/><\/figure>\n\n\n\n<p>Pipfile.lock\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/pic1.zhimg.com\/v2-5a2144c228fa9447f9600cf409c29e38_b.png\" alt=\"\"\/><\/figure>\n\n\n\n<p>pipfile \u5217\u51fa\u4e86\u6211\u4eec\u6240\u5b89\u88c5\u7684\u5e93\u548c Python \u7248\u672c\u7b49\u4fe1\u606f\uff0cPipfile.lock \u66f4\u4e3a\u8be6\u7ec6\uff0c\u5176\u4e2d\u8fd8\u5305\u542b\u4e86\u5e93\u7684\u54c8\u5e0c\u503c\uff0c\u8fd9\u6837\u6211\u4eec\u5728\u751f\u4ea7\u73af\u5883\u4e2d\u4f7f\u7528\u8fd9\u4e9b\u5e93\u7684\u65f6\u5019\uff0c\u53ef\u4ee5\u4fdd\u8bc1\u5b89\u88c5\u5230\u7684\u5e93\u662f\u4e00\u6a21\u4e00\u6837\u7684\u3002<\/p>\n\n\n\n<p>\u503c\u5f97\u6ce8\u610f\u7684\u662f\uff0c\u8fd9\u4e24\u6587\u4ef6\u4e0d\u7528\u6211\u4eec\u624b\u52a8\u64cd\u4f5c\uff0c\u5b83\u4eec\u4f1a\u81ea\u52a8\u968f\u7740\u4f60\u7684 pipenv \u64cd\u4f5c\u800c\u66f4\u65b0\u3002<\/p>\n\n\n\n<p>\u4f60\u53ef\u4ee5\u4f7f\u7528 pipenv lock \u547d\u4ee4\u6765\u751f\u6210 Pipfile.lock\uff0c\u7136\u540e\u5728\u751f\u4ea7\u73af\u5883\u4e2d\uff0c\u4f60\u53ea\u9700\u8981 pipenv install\uff0c\u5c31\u53ef\u4ee5\u5b89\u88c5\u9879\u76ee\u6240\u4f9d\u8d56\u7684\u5e93\u4e86\u3002<\/p>\n\n\n\n<p>\u73b0\u5728\u4f60\u53ef\u4ee5\u76f4\u63a5\u4f7f\u7528 pipenv \u6765\u4ee3\u66ff\u8fd9\u4e9b\u73a9\u610f\u4e86\uff1apip\u3001requirements.txt\u3001virtualenv\u3002<\/p>\n\n\n\n<h2>pipenv \u5e38\u7528\u7684\u547d\u4ee4<\/h2>\n\n\n\n<p>pipenv \u6709\u4e00\u4e9b\u5f88\u597d\u7528\u7684\u5305\u7ba1\u7406\u547d\u4ee4\uff0c\u63a5\u4e0b\u6765\u7ed9\u4f60\u4ecb\u7ecd\u51e0\u4e2a\u5e38\u7528\u5230\u7684\u547d\u4ee4\uff1a<\/p>\n\n\n\n<p>\u68c0\u67e5\u5e93\u7684\u5b89\u5168\u6027\uff1a<\/p>\n\n\n\n<p><strong>pipenv check<\/strong> <\/p>\n\n\n\n<p>\u4f60\u521a\u770b\u5230\u7684\u5e93\u7684\u5b89\u88c5:<\/p>\n\n\n\n<p><strong>piping install<\/strong><\/p>\n\n\n\n<p>\u67e5\u770b\u5e93\u7684\u4f9d\u8d56\u5173\u7cfb\uff1a<\/p>\n\n\n\n<p><strong>pipenv graph<\/strong> <\/p>\n\n\n\n<p>\u5378\u8f7d\u5e93\uff1a<\/p>\n\n\n\n<p><strong>pipenv uninstall click<\/strong> <\/p>\n\n\n\n<p>\u66f4\u65b0\uff1a<\/p>\n\n\n\n<p><strong>pipenv update<\/strong><\/p>\n\n\n\n<p>\u67e5\u770b\u5177\u4f53\u7684\u5e93\uff1a<\/p>\n\n\n\n<p><strong>pipenv open requests<\/strong><\/p>\n\n\n\n<p>\u8fdb\u5165\u865a\u62df\u73af\u5883\uff1a<\/p>\n\n\n\n<p><strong>pipenv shell<\/strong><\/p>\n\n\n\n<p>\u9000\u51fa\u865a\u62df\u73af\u5883\uff1a<strong>exit<\/strong><\/p>\n\n\n\n<p>\u5b89\u88c5 Pipfile.lock \u4e2d\u7684\u5e93\uff1a<\/p>\n\n\n\n<p><strong>pipenv sync <\/strong><\/p>\n\n\n\n<p>\u4e8b\u5b9e\u4e0a\uff0c\u4f60\u53ef\u4ee5\u76f4\u63a5\u8f93\u5165 pipenv\uff0c\u53ef\u4ee5\u770b\u5230\u547d\u4ee4\u548c\u53c2\u6570\u7684\u4f7f\u7528\u89e3\u91ca\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/pic2.zhimg.com\/v2-6505a446609afb6a5d6ee42807c843e1_b.png\" alt=\"\"\/><\/figure>\n\n\n\n<p>OK\uff0c\u4ee5\u4e0a\u5c31\u662f\u5c0f\u5e05b\u4eca\u5929\u7ed9\u4f60\u5e26\u6765\u7684\u5206\u4eab\uff0c\u5e0c\u671b\u5bf9\u4f60\u6709\u5e2e\u52a9\u3002<\/p>\n\n\n\n<p><strong>\u5b66\u4e60python\u7684\u6b63\u786e\u59ff\u52bf<\/strong>\u5feb\uff0c\u5173\u6ce8\u4e00\u6ce2\u2014\u2014\u2014\u2014\u2014\u2014&gt;\u63a5\u4e0b\u6765\uff0c\u5c31\u662f\u5b66\u4e60 python \u7684\u6b63\u786e\u59ff\u52bf\u3002\u5c0f\u5e05b\u5e26\u4f60\u73a9\u8f6c python \uff01<\/p>\n\n\n\n<p>\u90a3\u4e48\u6211\u4eec\u4e0b\u56de\u89c1\uff0c<strong>peace\uff01<\/strong><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u200b\u6211\u4eec\u5728\u5f00\u53d1 Python \u9879\u76ee\u7684\u65f6\u5019\uff0c\u6211\u4eec\u603b\u4f1a\u4f7f\u7528\u5230\u8fd9\u4e48\u51e0\u4e2a\u73a9\u610f\uff1a pip requirements.txt vent \u5f53\u4f60\u521b\u5efa\u4e00\u4e2a Python \u9879\u76ee\u7684\u65f6\u5019\uff0c\u4f60\u4f1a\u5148\u6574\u4e00\u4e2a\u865a\u62df\u73af\u5883\uff08virtualenv\uff09\uff0c\u5728\u8fd9\u91cc\u9762\u4f7f\u7528\u5230\u7684\u7b2c\u4e09\u65b9\u6a21\u5757\uff0c\u7248\u672c\u7b49\uff0c\u90fd\u53ea\u4f5c&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[303],"tags":[543,19,544,135,133],"_links":{"self":[{"href":"https:\/\/vip.fxxkpython.com\/index.php?rest_route=\/wp\/v2\/posts\/6329"}],"collection":[{"href":"https:\/\/vip.fxxkpython.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/vip.fxxkpython.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/vip.fxxkpython.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/vip.fxxkpython.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=6329"}],"version-history":[{"count":4,"href":"https:\/\/vip.fxxkpython.com\/index.php?rest_route=\/wp\/v2\/posts\/6329\/revisions"}],"predecessor-version":[{"id":6340,"href":"https:\/\/vip.fxxkpython.com\/index.php?rest_route=\/wp\/v2\/posts\/6329\/revisions\/6340"}],"wp:attachment":[{"href":"https:\/\/vip.fxxkpython.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=6329"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/vip.fxxkpython.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=6329"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/vip.fxxkpython.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=6329"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}