{"id":974395,"date":"2024-12-27T06:04:50","date_gmt":"2024-12-26T22:04:50","guid":{"rendered":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/974395.html"},"modified":"2024-12-27T06:04:52","modified_gmt":"2024-12-26T22:04:52","slug":"python%e5%a6%82%e4%bd%95%e5%af%bc%e5%85%a5egg","status":"publish","type":"post","link":"https:\/\/docs.pingcode.com\/ask\/974395.html","title":{"rendered":"python+\u5982\u4f55\u5bfc\u5165egg"},"content":{"rendered":"<p style=\"text-align:center;\" ><img decoding=\"async\" src=\"https:\/\/cdn-kb.worktile.com\/kb\/wp-content\/uploads\/2024\/04\/24200128\/8b8c9f0c-dbef-401e-84c3-e3f5ce93976b.webp\" alt=\"python+\u5982\u4f55\u5bfc\u5165egg\" \/><\/p>\n<p><p> <strong>\u8981\u5728Python\u4e2d\u5bfc\u5165EGG\u6587\u4ef6\uff0c\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u6b65\u9aa4\uff1a\u786e\u4fdd\u4f60\u7684EGG\u6587\u4ef6\u5728Python\u7684\u641c\u7d22\u8def\u5f84\u4e2d\u3001\u4f7f\u7528setuptools\u6a21\u5757\u63d0\u4f9b\u7684easy_install\u5de5\u5177\u3001\u4f7f\u7528pkg_resources\u6a21\u5757\u8bfb\u53d6EGG\u6587\u4ef6\u4e2d\u7684\u6a21\u5757\u548c\u8d44\u6e90\u3002<\/strong>\u8fd9\u5176\u4e2d\uff0c\u4f7f\u7528<code>pkg_resources<\/code>\u662f\u4e00\u4e2a\u975e\u5e38\u7075\u6d3b\u7684\u65b9\u6cd5\uff0c\u5b83\u4e0d\u4ec5\u53ef\u4ee5\u7528\u6765\u5bfc\u5165\u6a21\u5757\uff0c\u8fd8\u53ef\u4ee5\u83b7\u53d6EGG\u6587\u4ef6\u4e2d\u7684\u5176\u4ed6\u8d44\u6e90\u3002<code>easy_install<\/code>\u5219\u63d0\u4f9b\u4e86\u4e00\u79cd\u5feb\u901f\u5b89\u88c5\u548c\u7ba1\u7406EGG\u6587\u4ef6\u7684\u65b9\u6cd5\u3002\u63a5\u4e0b\u6765\uff0c\u6211\u4eec\u5c06\u8be6\u7ec6\u63a2\u8ba8\u8fd9\u4e9b\u65b9\u6cd5\u3002<\/p>\n<\/p>\n<p><p>\u4e00\u3001EGG\u6587\u4ef6\u7684\u57fa\u672c\u6982\u5ff5\u4e0e\u7528\u9014<\/p>\n<\/p>\n<p><p>EGG\u6587\u4ef6\u662f\u4e00\u79cd\u7528\u4e8e\u6253\u5305\u548c\u5206\u53d1Python\u9879\u76ee\u7684\u683c\u5f0f\uff0c\u7c7b\u4f3c\u4e8eJava\u7684JAR\u6587\u4ef6\u3002\u5b83\u5305\u542b\u4e86\u9879\u76ee\u7684\u4ee3\u7801\u3001\u5143\u6570\u636e\u4ee5\u53ca\u4f9d\u8d56\u4fe1\u606f\u3002EGG\u683c\u5f0f\u5728Python\u793e\u533a\u5185\u66fe\u7ecf\u88ab\u5e7f\u6cdb\u4f7f\u7528\uff0c\u4e3b\u8981\u7528\u4e8e\u53d1\u5e03Python\u5e93\u548c\u5e94\u7528\u3002<\/p>\n<\/p>\n<ol>\n<li>\n<p><strong>EGG\u6587\u4ef6\u7684\u7ed3\u6784<\/strong><\/p>\n<\/p>\n<p><p>EGG\u6587\u4ef6\u901a\u5e38\u662f\u4e00\u4e2a\u538b\u7f29\u7684ZIP\u6587\u4ef6\uff0c\u5305\u542b\u4e86Python\u5305\u7684\u6240\u6709\u5fc5\u8981\u4fe1\u606f\u3002\u5b83\u5305\u62ec\u4e86Python\u4ee3\u7801\u3001\u4f9d\u8d56\u5173\u7cfb\u3001\u5143\u6570\u636e\u7b49\u4fe1\u606f\u3002\u8fd9\u79cd\u683c\u5f0f\u4f7f\u5f97Python\u9879\u76ee\u7684\u5206\u53d1\u548c\u5b89\u88c5\u53d8\u5f97\u975e\u5e38\u65b9\u4fbf\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>EGG\u6587\u4ef6\u7684\u4f18\u7f3a\u70b9<\/strong><\/p>\n<\/p>\n<p><p>\u4f7f\u7528EGG\u6587\u4ef6\u7684\u4e3b\u8981\u4f18\u52bf\u5728\u4e8e\u5176\u4fbf\u6377\u6027\u548c\u81ea\u5305\u542b\u6027\u3002\u5b83\u53ef\u4ee5\u5305\u542b\u6240\u6709\u5fc5\u8981\u7684\u6587\u4ef6\u548c\u4fe1\u606f\uff0c\u4fbf\u4e8e\u9879\u76ee\u7684\u5206\u53d1\u548c\u5b89\u88c5\u3002\u7136\u800c\uff0cEGG\u6587\u4ef6\u4e5f\u6709\u5176\u5c40\u9650\u6027\uff0c\u6bd4\u5982\u5bf9\u5e73\u53f0\u7684\u4f9d\u8d56\u6027\u548c\u5bf9\u52a8\u6001\u6a21\u5757\u7684\u652f\u6301\u4e0d\u591f\u53cb\u597d\u3002<\/p>\n<\/p>\n<\/li>\n<\/ol>\n<p><p>\u4e8c\u3001\u786e\u4fddEGG\u6587\u4ef6\u5728Python\u7684\u641c\u7d22\u8def\u5f84\u4e2d<\/p>\n<\/p>\n<p><p>\u5728\u5bfc\u5165EGG\u6587\u4ef6\u4e4b\u524d\uff0c\u9996\u5148\u9700\u8981\u786e\u4fdd\u8be5\u6587\u4ef6\u4f4d\u4e8ePython\u7684\u641c\u7d22\u8def\u5f84\u4e2d\u3002\u5982\u679cEGG\u6587\u4ef6\u4e0d\u5728\u9ed8\u8ba4\u8def\u5f84\u4e2d\uff0c\u53ef\u4ee5\u901a\u8fc7\u4fee\u6539<code>sys.path<\/code>\u6765\u6dfb\u52a0\u65b0\u7684\u641c\u7d22\u8def\u5f84\u3002<\/p>\n<\/p>\n<ol>\n<li>\n<p><strong>\u4fee\u6539sys.path<\/strong><\/p>\n<\/p>\n<p><p>\u53ef\u4ee5\u5728Python\u811a\u672c\u7684\u5f00\u5934\u90e8\u5206\u4f7f\u7528\u4ee5\u4e0b\u4ee3\u7801\u6765\u6dfb\u52a0EGG\u6587\u4ef6\u7684\u8def\u5f84\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import sys<\/p>\n<p>sys.path.append(&#39;\/path\/to\/your\/eggfile.egg&#39;)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8fd9\u6837\uff0cPython\u5c31\u80fd\u591f\u5728\u65b0\u7684\u8def\u5f84\u4e2d\u67e5\u627e\u5e76\u5bfc\u5165EGG\u6587\u4ef6\u4e2d\u7684\u6a21\u5757\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u4f7f\u7528PYTHONPATH\u73af\u5883\u53d8\u91cf<\/strong><\/p>\n<\/p>\n<p><p>\u53e6\u4e00\u79cd\u65b9\u6cd5\u662f\u4f7f\u7528<code>PYTHONPATH<\/code>\u73af\u5883\u53d8\u91cf\uff0c\u5c06EGG\u6587\u4ef6\u7684\u8def\u5f84\u6dfb\u52a0\u5230\u8be5\u53d8\u91cf\u4e2d\u3002\u8fd9\u79cd\u65b9\u6cd5\u9002\u7528\u4e8e\u9700\u8981\u5728\u591a\u4e2a\u811a\u672c\u4e2d\u4f7f\u7528\u76f8\u540c\u7684EGG\u6587\u4ef6\u7684\u60c5\u51b5\u3002<\/p>\n<\/p>\n<p><p>\u5728Linux\u548cMacOS\u7cfb\u7edf\u4e2d\uff0c\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">export PYTHONPATH=$PYTHONPATH:\/path\/to\/your\/eggfile.egg<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728Windows\u7cfb\u7edf\u4e2d\uff0c\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-cmd\">set PYTHONPATH=%PYTHONPATH%;C:\\path\\to\\your\\eggfile.egg<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<\/ol>\n<p><p>\u4e09\u3001\u4f7f\u7528setuptools\u6a21\u5757\u4e2d\u7684easy_install\u5de5\u5177<\/p>\n<\/p>\n<p><p><code>easy_install<\/code>\u662f<code>setuptools<\/code>\u6a21\u5757\u4e2d\u7684\u4e00\u4e2a\u5de5\u5177\uff0c\u7528\u4e8e\u5b89\u88c5\u548c\u7ba1\u7406Python\u5305\u3002\u5b83\u652f\u6301EGG\u6587\u4ef6\u7684\u5b89\u88c5\u548c\u5bfc\u5165\u3002<\/p>\n<\/p>\n<ol>\n<li>\n<p><strong>\u5b89\u88c5setuptools<\/strong><\/p>\n<\/p>\n<p><p>\u5728\u4f7f\u7528<code>easy_install<\/code>\u4e4b\u524d\uff0c\u9700\u8981\u786e\u4fdd<code>setuptools<\/code>\u6a21\u5757\u5df2\u7ecf\u5b89\u88c5\u3002\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u6765\u5b89\u88c5\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">pip install setuptools<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u4f7f\u7528easy_install\u5b89\u88c5EGG\u6587\u4ef6<\/strong><\/p>\n<\/p>\n<p><p>\u4f7f\u7528<code>easy_install<\/code>\u5de5\u5177\u53ef\u4ee5\u76f4\u63a5\u5b89\u88c5EGG\u6587\u4ef6\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">easy_install \/path\/to\/your\/eggfile.egg<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5b89\u88c5\u5b8c\u6210\u540e\uff0cEGG\u6587\u4ef6\u4e2d\u7684\u6a21\u5757\u5c31\u53ef\u4ee5\u50cf\u666e\u901a\u7684Python\u6a21\u5757\u4e00\u6837\u5bfc\u5165\u4e86\u3002<\/p>\n<\/p>\n<\/li>\n<\/ol>\n<p><p>\u56db\u3001\u4f7f\u7528pkg_resources\u6a21\u5757\u8bfb\u53d6EGG\u6587\u4ef6<\/p>\n<\/p>\n<p><p><code>pkg_resources<\/code>\u662f<code>setuptools<\/code>\u6a21\u5757\u4e2d\u7684\u4e00\u4e2a\u529f\u80fd\u5f3a\u5927\u7684\u5de5\u5177\uff0c\u53ef\u4ee5\u7528\u6765\u8bfb\u53d6\u548c\u7ba1\u7406EGG\u6587\u4ef6\u4e2d\u7684\u8d44\u6e90\u3002<\/p>\n<\/p>\n<ol>\n<li>\n<p><strong>\u5bfc\u5165pkg_resources\u6a21\u5757<\/strong><\/p>\n<\/p>\n<p><p>\u5728\u4f7f\u7528<code>pkg_resources<\/code>\u4e4b\u524d\uff0c\u9700\u8981\u5148\u5bfc\u5165\u8be5\u6a21\u5757\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import pkg_resources<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u52a0\u8f7dEGG\u6587\u4ef6\u4e2d\u7684\u6a21\u5757<\/strong><\/p>\n<\/p>\n<p><p>\u4f7f\u7528<code>pkg_resources<\/code>\u53ef\u4ee5\u52a0\u8f7dEGG\u6587\u4ef6\u4e2d\u7684\u6a21\u5757\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">egg_name = &quot;your_egg_file.egg&quot;<\/p>\n<p>pkg_resources.working_set.add_entry(egg_name)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8fd9\u6837\u5c31\u53ef\u4ee5\u4f7f\u7528<code>import<\/code>\u8bed\u53e5\u5bfc\u5165EGG\u6587\u4ef6\u4e2d\u7684\u6a21\u5757\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u8bfb\u53d6EGG\u6587\u4ef6\u4e2d\u7684\u8d44\u6e90<\/strong><\/p>\n<\/p>\n<p><p><code>pkg_resources<\/code>\u8fd8\u53ef\u4ee5\u7528\u6765\u8bfb\u53d6EGG\u6587\u4ef6\u4e2d\u7684\u5176\u4ed6\u8d44\u6e90\uff0c\u6bd4\u5982\u6570\u636e\u6587\u4ef6\u6216\u914d\u7f6e\u6587\u4ef6\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">resource_content = pkg_resources.resource_string(&#39;your_module&#39;, &#39;resource_name&#39;)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8fd9\u79cd\u65b9\u6cd5\u975e\u5e38\u9002\u5408\u9700\u8981\u8bbf\u95eeEGG\u6587\u4ef6\u4e2d\u975ePython\u4ee3\u7801\u8d44\u6e90\u7684\u60c5\u51b5\u3002<\/p>\n<\/p>\n<\/li>\n<\/ol>\n<p><p>\u4e94\u3001\u4f7f\u7528pip\u5b89\u88c5\u548c\u7ba1\u7406EGG\u6587\u4ef6<\/p>\n<\/p>\n<p><p>\u867d\u7136<code>easy_install<\/code>\u66fe\u7ecf\u662f\u5b89\u88c5EGG\u6587\u4ef6\u7684\u4e3b\u8981\u5de5\u5177\uff0c\u4f46\u73b0\u5728<code>pip<\/code>\u5df2\u7ecf\u6210\u4e3aPython\u5305\u7ba1\u7406\u7684\u6807\u51c6\u5de5\u5177\u3002<code>pip<\/code>\u652f\u6301\u5b89\u88c5\u548c\u7ba1\u7406EGG\u6587\u4ef6\uff0c\u4f46\u4f7f\u7528\u65f6\u9700\u8981\u6ce8\u610f\u4e00\u4e9b\u4e8b\u9879\u3002<\/p>\n<\/p>\n<ol>\n<li>\n<p><strong>\u4f7f\u7528pip\u5b89\u88c5EGG\u6587\u4ef6<\/strong><\/p>\n<\/p>\n<p><p>\u53ef\u4ee5\u4f7f\u7528<code>pip<\/code>\u6765\u5b89\u88c5EGG\u6587\u4ef6\uff0c\u65b9\u6cd5\u5982\u4e0b\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">pip install \/path\/to\/your\/eggfile.egg<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p><code>pip<\/code>\u4f1a\u81ea\u52a8\u5c06EGG\u6587\u4ef6\u89e3\u538b\u5e76\u5b89\u88c5\u5176\u4e2d\u7684\u6a21\u5757\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u7ba1\u7406\u5df2\u5b89\u88c5\u7684EGG\u6587\u4ef6<\/strong><\/p>\n<\/p>\n<p><p>\u4f7f\u7528<code>pip<\/code>\u53ef\u4ee5\u65b9\u4fbf\u5730\u7ba1\u7406\u5df2\u5b89\u88c5\u7684EGG\u6587\u4ef6\uff1a<\/p>\n<\/p>\n<ul>\n<li>\n<p>\u5217\u51fa\u5df2\u5b89\u88c5\u7684\u5305\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">pip list<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<li>\n<p>\u5378\u8f7dEGG\u6587\u4ef6\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">pip uninstall package_name<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>\u6ce8\u610f\u4e8b\u9879<\/strong><\/p>\n<\/p>\n<p><p>\u5728\u4f7f\u7528<code>pip<\/code>\u5b89\u88c5EGG\u6587\u4ef6\u65f6\uff0c\u53ef\u80fd\u4f1a\u9047\u5230\u4e00\u4e9b\u517c\u5bb9\u6027\u95ee\u9898\uff0c\u5c24\u5176\u662f\u5728Python 3\u4e2d\u3002\u56e0\u6b64\uff0c\u5efa\u8bae\u5c3d\u91cf\u4f7f\u7528\u73b0\u4ee3\u7684\u5305\u683c\u5f0f\uff08\u5982Wheel\uff09\u6765\u66ff\u4ee3EGG\u683c\u5f0f\u3002<\/p>\n<\/p>\n<\/li>\n<\/ol>\n<p><p>\u516d\u3001EGG\u6587\u4ef6\u7684\u66ff\u4ee3\u65b9\u6848<\/p>\n<\/p>\n<p><p>\u968f\u7740Python\u793e\u533a\u7684\u53d1\u5c55\uff0cEGG\u6587\u4ef6\u9010\u6e10\u88ab\u66f4\u73b0\u4ee3\u7684\u683c\u5f0f\u6240\u53d6\u4ee3\uff0c\u6700\u5e38\u89c1\u7684\u66ff\u4ee3\u65b9\u6848\u662fWheel\u683c\u5f0f\u3002<\/p>\n<\/p>\n<ol>\n<li>\n<p><strong>Wheel\u683c\u5f0f\u7684\u4f18\u52bf<\/strong><\/p>\n<\/p>\n<p><p>Wheel\u683c\u5f0f\u662fPython\u6253\u5305\u548c\u5206\u53d1\u7684\u63a8\u8350\u683c\u5f0f\uff0c\u5177\u6709\u66f4\u597d\u7684\u517c\u5bb9\u6027\u548c\u6027\u80fd\u3002\u5b83\u4e0d\u4ec5\u53ef\u4ee5\u6253\u5305\u7eafPython\u4ee3\u7801\uff0c\u8fd8\u53ef\u4ee5\u5305\u542b\u9884\u7f16\u8bd1\u7684C\u6269\u5c55\u6a21\u5757\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u5c06EGG\u6587\u4ef6\u8f6c\u6362\u4e3aWheel\u683c\u5f0f<\/strong><\/p>\n<\/p>\n<p><p>\u53ef\u4ee5\u4f7f\u7528<code>setuptools<\/code>\u548c<code>wheel<\/code>\u5de5\u5177\u5c06EGG\u6587\u4ef6\u8f6c\u6362\u4e3aWheel\u683c\u5f0f\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">pip install wheel<\/p>\n<p>python setup.py bdist_wheel<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8f6c\u6362\u540e\u751f\u6210\u7684<code>.whl<\/code>\u6587\u4ef6\u53ef\u4ee5\u4f7f\u7528<code>pip<\/code>\u76f4\u63a5\u5b89\u88c5\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u793e\u533a\u5bf9Wheel\u683c\u5f0f\u7684\u652f\u6301<\/strong><\/p>\n<\/p>\n<p><p>\u5927\u591a\u6570Python\u9879\u76ee\u548c\u5e93\u73b0\u5728\u90fd\u63d0\u4f9bWheel\u683c\u5f0f\u7684\u5206\u53d1\u5305\uff0c\u5e76\u4e14<code>pip<\/code>\u548c<code>setuptools<\/code>\u5bf9Wheel\u683c\u5f0f\u7684\u652f\u6301\u66f4\u52a0\u5b8c\u5584\u3002\u56e0\u6b64\uff0c\u5efa\u8bae\u5728\u53ef\u80fd\u7684\u60c5\u51b5\u4e0b\u4f18\u5148\u4f7f\u7528Wheel\u683c\u5f0f\u3002<\/p>\n<\/p>\n<\/li>\n<\/ol>\n<p><p>\u603b\u7ed3\uff1a\u5bfc\u5165\u548c\u4f7f\u7528EGG\u6587\u4ef6\u867d\u7136\u5728\u67d0\u4e9b\u60c5\u51b5\u4e0b\u4ecd\u7136\u6709\u7528\uff0c\u4f46\u968f\u7740Python\u751f\u6001\u7cfb\u7edf\u7684\u53d1\u5c55\uff0c\u5efa\u8bae\u9010\u6b65\u8fc7\u6e21\u5230\u4f7f\u7528\u66f4\u73b0\u4ee3\u7684Wheel\u683c\u5f0f\u3002\u901a\u8fc7\u638c\u63e1EGG\u6587\u4ef6\u7684\u57fa\u672c\u6982\u5ff5\u548c\u4f7f\u7528\u65b9\u6cd5\uff0c\u53ef\u4ee5\u66f4\u597d\u5730\u7406\u89e3Python\u9879\u76ee\u7684\u6253\u5305\u548c\u5206\u53d1\u673a\u5236\uff0c\u540c\u65f6\u4e5f\u4e3a\u5411\u66f4\u73b0\u4ee3\u7684\u683c\u5f0f\u8fc1\u79fb\u505a\u597d\u51c6\u5907\u3002<\/p>\n<\/p>\n<h2><strong>\u76f8\u5173\u95ee\u7b54FAQs\uff1a<\/strong><\/h2>\n<p> <strong>\u5982\u4f55\u5728Python\u4e2d\u627e\u5230\u5e76\u4f7f\u7528egg\u6587\u4ef6\uff1f<\/strong><br \/>\u5728Python\u4e2d\uff0cegg\u6587\u4ef6\u901a\u5e38\u662f\u4e00\u4e2a\u6253\u5305\u7684Python\u5e93\uff0c\u5305\u542b\u4e86\u4ee3\u7801\u548c\u5143\u6570\u636e\u3002\u8981\u4f7f\u7528egg\u6587\u4ef6\uff0c\u9996\u5148\u9700\u8981\u786e\u4fdd\u4f60\u5df2\u5b89\u88c5\u4e86setuptools\u5e93\u3002\u53ef\u4ee5\u901a\u8fc7\u547d\u4ee4<code>pip install setuptools<\/code>\u6765\u5b89\u88c5\u3002\u63a5\u4e0b\u6765\uff0c\u53ef\u4ee5\u4f7f\u7528<code>easy_install<\/code>\u547d\u4ee4\u6765\u5bfc\u5165egg\u6587\u4ef6\uff0c\u547d\u4ee4\u683c\u5f0f\u4e3a<code>easy_install path\/to\/yourfile.egg<\/code>\u3002\u5bfc\u5165\u540e\uff0c\u5e93\u4e2d\u7684\u6a21\u5757\u53ef\u4ee5\u76f4\u63a5\u5728Python\u4ee3\u7801\u4e2d\u5bfc\u5165\u4f7f\u7528\u3002<\/p>\n<p><strong>egg\u6587\u4ef6\u4e0ewheel\u6587\u4ef6\u6709\u4ec0\u4e48\u533a\u522b\uff1f<\/strong><br \/>egg\u6587\u4ef6\u548cwheel\u6587\u4ef6\u90fd\u662fPython\u7684\u5305\u683c\u5f0f\uff0c\u4f46\u5b83\u4eec\u4e4b\u95f4\u5b58\u5728\u4e00\u4e9b\u5dee\u5f02\u3002egg\u6587\u4ef6\u662f\u8f83\u65e9\u7684\u5305\u683c\u5f0f\uff0c\u63d0\u4f9b\u4e86\u7b80\u5355\u7684\u6253\u5305\u548c\u5206\u53d1\u529f\u80fd\uff0c\u800cwheel\u6587\u4ef6\u5219\u662fPython\u5b98\u65b9\u63a8\u8350\u7684\u65b0\u7684\u5305\u683c\u5f0f\uff0c\u65e8\u5728\u66ff\u4ee3egg\u6587\u4ef6\uff0c\u63d0\u4f9b\u66f4\u597d\u7684\u517c\u5bb9\u6027\u548c\u66f4\u7b80\u5316\u7684\u5b89\u88c5\u8fc7\u7a0b\u3002\u901a\u5e38\u5efa\u8bae\u4f7f\u7528wheel\u6587\u4ef6\uff0c\u56e0\u4e3a\u5b83\u66f4\u5bb9\u6613\u5b89\u88c5\u4e14\u652f\u6301\u66f4\u591a\u529f\u80fd\u3002<\/p>\n<p><strong>\u5982\u4f55\u5c06egg\u6587\u4ef6\u8f6c\u6362\u4e3a\u5176\u4ed6\u683c\u5f0f\u4ee5\u4fbf\u4e8e\u4f7f\u7528\uff1f<\/strong><br \/>\u5982\u679c\u9700\u8981\u5c06egg\u6587\u4ef6\u8f6c\u6362\u4e3a\u5176\u4ed6\u683c\u5f0f\uff0c\u4f8b\u5982wheel\u6587\u4ef6\uff0c\u53ef\u4ee5\u4f7f\u7528<code>wheel<\/code>\u5de5\u5177\u3002\u9996\u5148\uff0c\u786e\u4fdd\u4f60\u5df2\u5b89\u88c5wheel\u5e93\uff0c\u901a\u8fc7\u547d\u4ee4<code>pip install wheel<\/code>\u6765\u5b8c\u6210\u3002\u7136\u540e\uff0c\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u8fdb\u884c\u8f6c\u6362\uff1a<code>pip install -e path\/to\/yourfile.egg<\/code>\uff0c\u8fd9\u5c06\u81ea\u52a8\u5c06egg\u6587\u4ef6\u8f6c\u6362\u4e3awheel\u683c\u5f0f\uff0c\u5e76\u5728\u5f53\u524d\u73af\u5883\u4e2d\u53ef\u7528\u3002\u8fd9\u6837\uff0c\u60a8\u53ef\u4ee5\u66f4\u65b9\u4fbf\u5730\u7ba1\u7406\u548c\u4f7f\u7528Python\u5e93\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"\u8981\u5728Python\u4e2d\u5bfc\u5165EGG\u6587\u4ef6\uff0c\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u6b65\u9aa4\uff1a\u786e\u4fdd\u4f60\u7684EGG\u6587\u4ef6\u5728Python\u7684\u641c\u7d22\u8def\u5f84\u4e2d\u3001\u4f7f\u7528setu [&hellip;]","protected":false},"author":3,"featured_media":974400,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[37],"tags":[],"acf":[],"_links":{"self":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/974395"}],"collection":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/comments?post=974395"}],"version-history":[{"count":"1","href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/974395\/revisions"}],"predecessor-version":[{"id":974405,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/974395\/revisions\/974405"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media\/974400"}],"wp:attachment":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media?parent=974395"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/categories?post=974395"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/tags?post=974395"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}