{"id":279552,"date":"2021-01-08T17:21:00","date_gmt":"2021-01-08T09:21:00","guid":{"rendered":"http:\/\/4563.org\/?p=279552"},"modified":"2021-01-08T17:21:00","modified_gmt":"2021-01-08T09:21:00","slug":"%e6%9c%a8%e5%85%b0%e7%bc%96%e7%a8%8b%e8%af%ad%e8%a8%80%e4%b8%8d%e5%90%8c%e8%bf%90%e8%a1%8c%e7%89%88%e6%9c%ac%e7%9a%84-python-sys-path-%e5%b7%ae%e5%bc%82%e5%b0%8f%e7%bb%93","status":"publish","type":"post","link":"http:\/\/4563.org\/?p=279552","title":{"rendered":"\u6728\u5170\u7f16\u7a0b\u8bed\u8a00\u4e0d\u540c\u8fd0\u884c\u7248\u672c\u7684 Python sys.path \u5dee\u5f02\u5c0f\u7ed3"},"content":{"rendered":"<div>\n<div>\n<div>\n<h1>                  \u6728\u5170\u7f16\u7a0b\u8bed\u8a00\u4e0d\u540c\u8fd0\u884c\u7248\u672c\u7684 Python sys.path \u5dee\u5f02\u5c0f\u7ed3               <\/h1>\n<p> <\/p>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : xuanwu <\/span>  <span><i><\/i> 3<\/span> <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<\/p><\/div>\n<div isfirst=\"1\"> <\/p>\n<p>\u539f\u6587\u5730\u5740\uff1a\u6728\u5170\u7f16\u7a0b\u8bed\u8a00\u4e0d\u540c\u8fd0\u884c\u7248\u672c\u7684 Python sys.path \u5dee\u5f02\u5c0f\u7ed3<\/p>\n<p>\u8282\u9009\uff1a<\/p>\n<h2>\u7ed3\u8bba<\/h2>\n<p>sys.path \u5728\u4e0d\u540c\u8fd0\u884c\u7248\u672c\u7684\u533a\u522b\u5982\u4e0b\uff1a<\/p>\n<ul>\n<li>PyPI \u53d1\u5e03\u7248\uff1a\u867d\u7136\u6dfb\u52a0\u4e86\u8fd0\u884c\u5f53\u524d\u76ee\u5f55\u5230 sys.path\uff0c\u4f46\u4f4d\u4e8e\u672b\u5c3e\u3002\u5728 sys.path \u4e2d\u66f4\u9760\u524d\u7684\u8def\u5f84\u4e2d\u5305\u542b Python3 \u7684\u5305\u8def\u5f84\uff0c\u5176\u4e2d\u6070\u597d\u5b58\u5728\u5176\u4ed6 test \u5305\uff0c\u800c\u4e14\u8be5\u5305\u4e2d\u6ca1\u6709 package \u5b50\u76ee\u5f55\uff0c\u56e0\u800c\u62a5\u9519\u3002<\/li>\n<li>exe \u53d1\u5e03\u7248\uff08\u7528 PyInstaller \u751f\u6210\uff09\uff1asys.path \u4e2d\u4e0d\u5305\u542b Python3 \u7684\u5305\u8def\u5f84\uff0c\u56e0\u800c\u4e0d\u4f1a\u8ba4\u9519 test \u5305\u3002<\/li>\n<li>\u5f00\u53d1\u7248\uff1a\u8fd0\u884c\u7684\u5f53\u524d\u76ee\u5f55\u4f4d\u4e8e sys.path \u7b2c\u4e00\u4e2a\u3002sys.path \u4e2d\u867d\u4e5f\u5305\u542b Python3 \u7684\u5305\u8def\u5f84\uff0c\u4f46\u7531\u4e8e\u987a\u5e8f\u9760\u540e\uff0c\u5e76\u4e0d\u8d77\u4f5c\u7528\uff0c\u56e0\u800c\u4e0d\u8ba4\u9519 test \u5305\u3002<\/li>\n<\/ul>\n<p>\u7531\u6b64\u6765\u770b\u91cd\u73b0\u9879\u76ee\u4e24\u79cd\u53d1\u5e03\u7248\u7684\u4f18\u52a3\u52bf\uff1a<\/p>\n<ul>\n<li>PyPI \u53d1\u5e03\u7248\uff1a\u7531\u4e8e\u81ea\u5e26 Python3 \u5305\u8def\u5f84\uff0c\u90a3\u4e48\u53ea\u8981\u662f\u5f53\u524d Python3 \u73af\u5883\u4e0b\u53ef\u7528\u7684\u5305\uff0c\u6728\u5170\u5373\u53ef\u5f15\u7528\u3002\u526f\u6548\u5e94\u5c31\u662f\u4e07\u4e00\u78b0\u5230\u4e0a\u9762\u8fd9\u6837\u7684\u540c\u540d\u5305\uff0c\u4f1a\u4f18\u5148\u5f15\u7528 Python3 \u81ea\u5e26\u5305\uff0c\u800c Python \u7684\u884c\u4e3a\u662f\u4f18\u5148\u5f15\u7528\u81ea\u5b9a\u4e49\u5305\u3002<\/li>\n<li>exe \u53d1\u5e03\u7248\uff1a\u7531\u4e8e\u4e0d\u5e26 Python3 \u5305\u8def\u5f84\uff0c\u6728\u5170\u5c06\u4e0d\u80fd\u5f15\u7528 Python3 \u73af\u5883\u4e0b\u5b89\u88c5\u7684\u5305\u3002\u5f53\u7136\u4e5f\u5c31\u6ca1\u6709\u540c\u540d\u5305\u7684\u4f18\u5148\u95ee\u9898\u3002\u4f46\u5982\u679c\u7528\u6237\u81ea\u884c\u914d\u7f6e\u4e86\u73af\u5883\u53d8\u91cf\uff0c\u4f7f\u5f97\u7cfb\u7edf\u8def\u5f84\u4e2d\u5305\u542b Python3 \u7684\u5305\u8def\u5f84\uff0c\u662f\u5426\u4f1a\u6709\u540c\u6837\u95ee\u9898\u5c1a\u5f85\u786e\u8ba4\u3002<\/li>\n<\/ul><\/div>\n<div> <b>\u5927\u4f6c\u6709\u8a71\u8aaa<\/b> (<span>0<\/span>)        <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<ul>\n<li>\n","protected":false},"excerpt":{"rendered":"<p>\u6728\u5170\u7f16\u7a0b\u8bed\u8a00\u4e0d\u540c\u8fd0\u884c\u7248\u672c\u7684 Pyt&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[],"tags":[],"_links":{"self":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/279552"}],"collection":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=279552"}],"version-history":[{"count":0,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/279552\/revisions"}],"wp:attachment":[{"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=279552"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=279552"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=279552"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}