{"id":25512,"date":"2025-04-19T12:46:51","date_gmt":"2025-04-19T04:46:51","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/25512.html"},"modified":"2025-04-19T12:46:51","modified_gmt":"2025-04-19T04:46:51","slug":"py%e8%84%9a%e6%9c%ac%e9%83%a8%e7%bd%b2%e5%88%b0%e6%9c%8d%e5%8a%a1%e5%99%a8%e5%ae%9a%e6%97%b6%e5%90%af%e5%8a%a8","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/25512.html","title":{"rendered":"py\u811a\u672c\u90e8\u7f72\u5230\u670d\u52a1\u5668\u5b9a\u65f6\u542f\u52a8"},"content":{"rendered":"<\/p>\n<h4>py\u811a\u672c\u90e8\u7f72\u5230\u670d\u52a1\u5668\u5b9a\u65f6\u542f\u52a8<\/h4>\n<ul>\n<li>\u4e00\u3001\u51c6\u5907\u597d\u4f60\u7684\u811a\u672c<\/li>\n<li>\u4e8c\u3001\u628a\u811a\u672c\u653e\u5230\u670d\u52a1\u5668<\/li>\n<li>\u4e09\u3001\u5728\u670d\u52a1\u5668\u521b\u5efa\u811a\u672c\u6240\u9700\u8981\u7684\u73af\u5883<\/li>\n<li>\n<ul>\n<li>1\u3001\u5b89\u88c5 Miniconda&#xff08;\u5982\u679c\u4e0d\u60f3\u5b89\u88c5 Anaconda \u6216 Miniconda&#xff0c;\u53ef\u4ee5\u76f4\u63a5\u4f7f\u7528 Python \u7684venv\u6a21\u5757\u521b\u5efa\u865a\u62df\u73af\u5883&#xff0c;\u4f46\u5b89\u88c5 Conda \u4f1a\u66f4\u65b9\u4fbf\u7ba1\u7406\u4e0d\u540c\u7248\u672c\u7684 Python \u548c\u5305&#xff09;<\/li>\n<li>2\u3001\u521b\u5efa Python 3.9 \u865a\u62df\u73af\u5883<\/li>\n<li>3\u3001\u5728\u865a\u62df\u73af\u5883\u4e0b\u8fd0\u884c\u4f60\u7684\u811a\u672c\u7a0b\u5e8f<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<h2>\u4e00\u3001\u51c6\u5907\u597d\u4f60\u7684\u811a\u672c<\/h2>\n<p>\u540e\u9762\u8bb2\u7684\u662f\u6211\u7528python\u5199\u7684\u4e00\u4e2a\u811a\u672c&#xff0c;\u4e3b\u8981\u662f\u81ea\u52a8\u66f4\u65b0\u6570\u636e\u7684&#xff0c;\u4f46\u8fd9\u4e2a\u4e0d\u91cd\u8981\u3002<\/p>\n<p>\u4e3b\u8981\u7684\u662f\u4ee3\u7801\u91cc\u9762&#xff0c;\u80fd\u8ba9\u811a\u672c\u5b9a\u65f6\u542f\u52a8\u7684\u5e93&#xff0c;\u8fd9\u4e2a\u5e93\u662fapscheduler\u3002\u5148\u5728\u672c\u5730\u6d4b\u8bd5\u770b\u770b\u80fd\u5426\u8fd0\u884c&#xff0c;\u6ca1\u95ee\u9898\u518d\u53bb\u90e8\u7f72\u5230\u670d\u52a1\u5668&#xff08;\u8fd9\u4e2a\u540e\u9762\u4f1a\u8bf4&#xff09;\u3002<\/p>\n<p>\u5148\u4e0b\u8f7dapscheduler\u5e93<\/p>\n<p>pip <span class=\"token function\">install<\/span> apscheduler<\/p>\n<p>\u7136\u540e\u5728\u4f60\u7684\u811a\u672c\u4ee3\u7801\u91cc\u52a0\u4e0a\u5b9a\u65f6\u542f\u52a8\u7684\u4ee3\u7801&#xff1a;<\/p>\n<p><span class=\"token comment\">#auto_quote.py\u7a0b\u5e8f\u7684\u4e3b\u8981\u6267\u884c\u51fd\u6570,\u53ea\u63d0\u53d6\u4e00\u90e8\u5206<\/span><br \/>\n<span class=\"token keyword\">def<\/span> <span class=\"token function\">exec_func<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">:<\/span><br \/>\n    start_time <span class=\"token operator\">&#061;<\/span> time<span class=\"token punctuation\">.<\/span>time<span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><br \/>\n    <span class=\"token keyword\">print<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#039;\u7a0b\u5e8f\u542f\u52a8&#xff0c;\u6570\u636e\u66f4\u65b0\u4e2d\u00b7\u00b7\u00b7&#039;<\/span><span class=\"token punctuation\">)<\/span><br \/>\n    vc <span class=\"token operator\">&#061;<\/span> VocalConcert<span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><br \/>\n    vc<span class=\"token punctuation\">.<\/span>main<span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><br \/>\n    end_time <span class=\"token operator\">&#061;<\/span> time<span class=\"token punctuation\">.<\/span>time<span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><br \/>\n    <span class=\"token keyword\">print<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#039;\u7a0b\u5e8f\u8fd0\u884c\u7ed3\u675f&#xff01;&#039;<\/span><span class=\"token punctuation\">)<\/span><br \/>\n    elapsed_time <span class=\"token operator\">&#061;<\/span> end_time <span class=\"token operator\">&#8211;<\/span> start_time<br \/>\n    <span class=\"token keyword\">print<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string-interpolation\"><span class=\"token string\">f&#034;\u7a0b\u5e8f\u8fd0\u884c\u65f6\u95f4: <\/span><span class=\"token interpolation\"><span class=\"token punctuation\">{<\/span>elapsed_time<span class=\"token punctuation\">:<\/span><span class=\"token format-spec\">.2f<\/span><span class=\"token punctuation\">}<\/span><\/span><span class=\"token string\"> \u79d2&#034;<\/span><\/span><span class=\"token punctuation\">)<\/span><\/p>\n<p><span class=\"token keyword\">if<\/span> __name__ <span class=\"token operator\">&#061;&#061;<\/span> <span class=\"token string\">&#039;__main__&#039;<\/span><span class=\"token punctuation\">:<\/span><br \/>\n<span class=\"token comment\">#\u8fd9\u6bb5\u4ee3\u7801\u5bfc\u5165\u4e86 apscheduler \u5e93\u4e2d\u7684 BlockingScheduler \u7c7b&#xff0c;\u5e76\u521b\u5efa\u4e86\u4e00\u4e2a\u8c03\u5ea6\u5668\u5bf9\u8c61 scheduler&#xff0c;<\/span><br \/>\n<span class=\"token comment\">#\u540c\u65f6\u6307\u5b9a\u4e86\u65f6\u533a\u4e3a Asia\/Shanghai&#xff08;\u4e0a\u6d77\u65f6\u533a&#xff09;\u3002<\/span><br \/>\n    scheduler <span class=\"token operator\">&#061;<\/span> BlockingScheduler<span class=\"token punctuation\">(<\/span>timezone<span class=\"token operator\">&#061;<\/span><span class=\"token string\">&#039;Asia\/Shanghai&#039;<\/span><span class=\"token punctuation\">)<\/span><br \/>\n    <span class=\"token triple-quoted-string string\">&#034;&#034;&#034;<br \/>\n    \u8fd9\u91cc\u5411\u8c03\u5ea6\u5668\u6dfb\u52a0\u4e86\u4e00\u4e2a\u4efb\u52a1\u3002\u5177\u4f53\u6765\u8bf4&#xff1a;<br \/>\nexec_func \u662f\u8981\u6267\u884c\u7684\u51fd\u6570\u3002<br \/>\n&#039;cron&#039; \u8868\u793a\u4f7f\u7528 cron \u8868\u8fbe\u5f0f\u7684\u65b9\u5f0f\u6765\u5b9a\u4e49\u4efb\u52a1\u7684\u89e6\u53d1\u65f6\u95f4\u3002<br \/>\nhour&#061;2, minute&#061;30 \u6307\u5b9a\u4efb\u52a1\u5728\u6bcf\u5929\u7684 2 \u70b9 30 \u5206\u89e6\u53d1\u3002<br \/>\nargs&#061;() \u8868\u793a\u4f20\u9012\u7ed9 exec_func \u51fd\u6570\u7684\u53c2\u6570\u4e3a\u7a7a\u5143\u7ec4\u3002<br \/>\nmax_instances&#061;100 \u8868\u793a\u5141\u8bb8\u540c\u65f6\u8fd0\u884c\u7684\u8be5\u4efb\u52a1\u7684\u6700\u5927\u5b9e\u4f8b\u6570\u4e3a 100\u3002<br \/>\nmisfire_grace_time&#061;360 \u8868\u793a\u4efb\u52a1\u9519\u8fc7\u9884\u5b9a\u6267\u884c\u65f6\u95f4\u540e\u7684\u5bbd\u9650\u65f6\u95f4\u4e3a 360 \u79d2\u3002<br \/>\n    &#034;&#034;&#034;<\/span><br \/>\n    scheduler<span class=\"token punctuation\">.<\/span>add_job<span class=\"token punctuation\">(<\/span>exec_func<span class=\"token punctuation\">,<\/span> <span class=\"token string\">&#039;cron&#039;<\/span><span class=\"token punctuation\">,<\/span> hour<span class=\"token operator\">&#061;<\/span><span class=\"token number\">9<\/span><span class=\"token punctuation\">,<\/span> minute<span class=\"token operator\">&#061;<\/span><span class=\"token number\">30<\/span><span class=\"token punctuation\">,<\/span> args<span class=\"token operator\">&#061;<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">,<\/span> max_instances<span class=\"token operator\">&#061;<\/span><span class=\"token number\">100<\/span><span class=\"token punctuation\">,<\/span> misfire_grace_time<span class=\"token operator\">&#061;<\/span><span class=\"token number\">360<\/span><span class=\"token punctuation\">)<\/span><br \/>\n    scheduler<span class=\"token punctuation\">.<\/span>start<span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><\/p>\n<h2>\u4e8c\u3001\u628a\u811a\u672c\u653e\u5230\u670d\u52a1\u5668<\/h2>\n<p>\u8fd9\u4e2a\u6700\u7b80\u5355\u7684\u65b9\u6cd5\u6211\u89c9\u5f97\u662f\u76f4\u63a5\u4e0b\u8f7dXftp\u8f6f\u4ef6&#xff0c;\u7136\u540e\u76f4\u63a5\u62c9\u8fc7\u53bb\u5c31\u53ef\u4ee5\u4e86\u3002 \u5de6\u8fb9\u662f\u6211\u4eec\u4e3b\u673a&#xff0c;\u53f3\u8fb9\u662f\u8fdc\u7a0b\u670d\u52a1\u5668\u3002 \u4f60\u53ef\u4ee5\u5728\u6839\u76ee\u5f55\u521b\u5efa\u4e00\u4e2adata\u6587\u4ef6\u5939&#xff0c;\u7136\u540e\u628a\u4f60\u7684\u811a\u672c\u6587\u4ef6\u62c9\u8fc7\u53bb\u5373\u53ef\u3002 <img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250419044650-68032aba8a1d3.png\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\" \/> \u6216\u8005\u4f60\u53ef\u4ee5\u4f7f\u7528Xshell\u8fdc\u7a0b\u8fde\u63a5\u670d\u52a1\u5668&#xff0c;\u7136\u540e\u4f60\u628a\u4f60\u7684\u4ee3\u7801\u5b58\u5230git\u4ed3\u5e93&#xff0c;\u518d\u901a\u8fc7\u547d\u4ee4\u628agit\u4ed3\u5e93\u7684\u4ee3\u7801pull\u8fc7\u6765&#xff0c;\u90fd\u4e00\u6837\u7684\u3002<\/p>\n<h2>\u4e09\u3001\u5728\u670d\u52a1\u5668\u521b\u5efa\u811a\u672c\u6240\u9700\u8981\u7684\u73af\u5883<\/h2>\n<p>\u4f60\u9700\u8981\u4e0b\u8f7d\u4e2apython\u89e3\u91ca\u5668\u624d\u80fd\u8ba9\u670d\u52a1\u5668\u770b\u5f97\u61c2\u4f60\u7684\u4ee3\u7801&#xff0c;\u56e0\u4e3a\u670d\u52a1\u5668\u4e5f\u662f\u4e00\u53f0\u4e3b\u673a&#xff0c;\u6240\u6709\u7684\u4e3b\u673a\u5176\u5b9e\u4e5f\u53ef\u4ee5\u6210\u4e3a\u670d\u52a1\u5668\u3002<\/p>\n<p>\u6211\u8fd9\u8fb9\u56e0\u4e3a\u670d\u52a1\u5668\u672c\u8eab\u6709\u9879\u76ee\u5b58\u5728&#xff0c;\u6240\u4ee5\u6211\u521b\u5efa\u4e86\u4e00\u4e2a\u865a\u62df\u73af\u5883\u53bb\u8fd0\u884c\u8fd9\u4e2a\u811a\u672c&#xff0c;\u4ee5\u514d\u5f71\u54cd\u5230\u5df2\u5b58\u5728\u7684\u9879\u76ee&#xff0c;\u5982\u679c\u6ca1\u6709\u7684\u8bdd\u76f4\u63a5\u6574\u5c31\u884c\u4e86\u3002<\/p>\n<p>\u4ee5\u4e0b\u662f\u5728\u963f\u91cc\u4e91\u670d\u52a1\u5668\u4e0a\u90e8\u7f72 Python 3.9 \u865a\u62df\u73af\u5883\u800c\u4e0d\u5f71\u54cd\u5df2\u6709\u9879\u76ee\u7684\u6b65\u9aa4&#xff1a;<\/p>\n<h3>1\u3001\u5b89\u88c5 Miniconda&#xff08;\u5982\u679c\u4e0d\u60f3\u5b89\u88c5 Anaconda \u6216 Miniconda&#xff0c;\u53ef\u4ee5\u76f4\u63a5\u4f7f\u7528 Python \u7684venv\u6a21\u5757\u521b\u5efa\u865a\u62df\u73af\u5883&#xff0c;\u4f46\u5b89\u88c5 Conda \u4f1a\u66f4\u65b9\u4fbf\u7ba1\u7406\u4e0d\u540c\u7248\u672c\u7684 Python \u548c\u5305&#xff09;<\/h3>\n<p>\u5728\u5b89\u88c5 Miniconda \u65f6\u53ef\u4ee5\u6307\u5b9a\u5b89\u88c5\u8def\u5f84\u3002\u4ee5\u4e0b\u662f\u5b89\u88c5 Miniconda \u5e76\u6307\u5b9a\u8def\u5f84\u7684\u6b65\u9aa4&#xff1a;<\/p>\n<p><span class=\"token function\">wget<\/span> https:\/\/repo.anaconda.com\/miniconda\/Miniconda3-latest-Linux-x86_64.sh<\/p>\n<p>\u6307\u5b9a\u5b89\u88c5\u8def\u5f84\u8fdb\u884c\u5b89\u88c5&#xff0c;\u4f8b\u5982\u5b89\u88c5\u5230\/opt\/miniconda3&#xff1a;<\/p>\n<p><span class=\"token function\">bash<\/span> Miniconda3-latest-Linux-x86_64.sh <span class=\"token parameter variable\">-p<\/span> \/opt\/miniconda3<\/p>\n<p>\u5728\u5b89\u88c5\u8fc7\u7a0b\u4e2d&#xff0c;\u4f1a\u6709\u4e00\u4e9b\u63d0\u793a\u9700\u8981\u786e\u8ba4&#xff0c;\u6309\u56de\u8f66\u952e\u6216\u8f93\u5165\u76f8\u5e94\u7684\u56de\u7b54\u8fdb\u884c\u786e\u8ba4\u3002<\/p>\n<p>\u5b89\u88c5\u5b8c\u6210\u540e&#xff0c;\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u65b9\u5f0f\u6fc0\u6d3b Miniconda&#xff1a;<\/p>\n<p><span class=\"token builtin class-name\">source<\/span> \/opt\/miniconda3\/bin\/activate<\/p>\n<h3>2\u3001\u521b\u5efa Python 3.9 \u865a\u62df\u73af\u5883<\/h3>\n<p>\u4f7f\u7528 Conda \u521b\u5efa\u4e00\u4e2a\u65b0\u7684\u865a\u62df\u73af\u5883&#xff0c;\u547d\u540d\u4e3amyenv&#xff08;\u53ef\u4ee5\u81ea\u5b9a\u4e49\u540d\u79f0&#xff09;&#xff1a;<\/p>\n<p>conda create <span class=\"token parameter variable\">-n<\/span> myenv <span class=\"token assign-left variable\">python<\/span><span class=\"token operator\">&#061;<\/span><span class=\"token number\">3.9<\/span><\/p>\n<p>\u6fc0\u6d3b\u865a\u62df\u73af\u5883&#xff1a;<\/p>\n<p>conda activate myenv<\/p>\n<p>\u73b0\u5728\u4f60\u53ef\u4ee5\u5728\u8fd9\u4e2a\u865a\u62df\u73af\u5883\u4e2d\u5b89\u88c5\u9879\u76ee\u6240\u9700\u7684\u5305&#xff0c;\u800c\u4e0d\u4f1a\u5f71\u54cd\u670d\u52a1\u5668\u4e0a\u5df2\u6709\u7684\u9879\u76ee\u3002<\/p>\n<p>\u5f53\u4f60\u4f7f\u7528conda create -n myenv python&#061;3.9\u521b\u5efa\u73af\u5883\u65f6&#xff0c;\u73af\u5883\u901a\u5e38\u5b58\u50a8\u5728 Conda \u7684\u5b89\u88c5\u76ee\u5f55\u4e0b\u7684envs\u6587\u4ef6\u5939\u4e2d\u3002 \u4f8b\u5982&#xff0c;\u5982\u679c\u4f60\u7684 Conda \u5b89\u88c5\u5728\/opt\/miniconda3&#xff0c;\u90a3\u4e48\u65b0\u521b\u5efa\u7684\u73af\u5883myenv\u4f1a\u4f4d\u4e8e\/opt\/miniconda3\/envs\/myenv\u3002\u6240\u4ee5\u4e0d\u7528\u62c5\u5fc3\u3002<\/p>\n<p>\u6fc0\u6d3b\u865a\u62df\u73af\u5883\u540e&#xff0c;\u4f60\u5c31\u53ef\u4ee5\u5728\u8fd9\u4e2a\u73af\u5883\u91cc\u9762\u4e0b\u8f7d\u4f60\u811a\u672c\u9700\u8981\u7528\u5230\u7684\u5e93&#xff0c;\u800c\u4e0d\u4f1a\u4e0e\u539f\u6765\u7684\u9879\u76ee\u4ea7\u751f\u51b2\u7a81\u4e86\u3002<\/p>\n<p>pip <span class=\"token function\">install<\/span> apscheduler<br \/>\n<span class=\"token comment\">#\u7b49\u7b49&#8230;<\/span><\/p>\n<p>\u4f60\u4e5f\u53ef\u4ee5\u628a\u9700\u8981\u7528\u5230\u7684\u5e93\u5199\u5728\u4e00\u4e2atxt\u6587\u4ef6\u91cc&#xff0c;\u7136\u540e\u76f4\u63a5\u5168\u91cf\u4e0b\u8f7d\u4e5f\u53ef\u4ee5\u3002<\/p>\n<p>ps: \u5f53\u4f60\u9700\u8981\u5207\u6362\u56de\u670d\u52a1\u5668\u7684\u9ed8\u8ba4\u73af\u5883\u6216\u5176\u4ed6\u5df2\u6709\u9879\u76ee\u7684\u73af\u5883\u65f6&#xff0c;\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4&#xff1a;<\/p>\n<p>conda deactivate<\/p>\n<h3>3\u3001\u5728\u865a\u62df\u73af\u5883\u4e0b\u8fd0\u884c\u4f60\u7684\u811a\u672c\u7a0b\u5e8f<\/h3>\n<p>\u5728\u4e0a\u4e00\u6b65\u7684\u57fa\u7840\u4e0a&#xff0c;\u6211\u4eec\u8fdb\u5165\u5230\u811a\u672c\u6587\u4ef6\u6240\u5728\u7684\u4f4d\u7f6e&#xff1a;<\/p>\n<p><span class=\"token builtin class-name\">cd<\/span> data<\/p>\n<p>\u67e5\u770b\u5f53\u524d\u6587\u4ef6\u5939\u4f4d\u7f6e:<\/p>\n<p><span class=\"token builtin class-name\">pwd<\/span><\/p>\n<p>\u67e5\u770b\u5f53\u524d\u6587\u4ef6\u5939\u4e0b\u7684\u4fe1\u606f:<\/p>\n<p><span class=\"token function\">ls<\/span><\/p>\n<p>\u5728\u8fd0\u884c\u4e4b\u524d&#xff0c;\u786e\u4fdd\u4f60\u5728\u670d\u52a1\u5668\u4e0a\u7684\u547d\u4ee4\u884c\u5904\u4e8e\u5305\u542b\u8be5 .py \u6587\u4ef6\u7684\u76ee\u5f55\u4e0b&#xff0c;\u6216\u8005\u4f7f\u7528\u6b63\u786e\u7684\u6587\u4ef6\u8def\u5f84\u6765\u8fd0\u884c\u811a\u672c&#xff0c;\u6bd4\u5982&#xff1a;<\/p>\n<p>python your_script.py<\/p>\n<p>your_script.py\u662f\u4f60\u7684\u811a\u672c\u540d&#xff0c;\u6211\u8fd9\u91cc\u7528auto_quote.py<\/p>\n<p>\u4f60\u5c31\u53ef\u4ee5\u770b\u5230\u4f60\u7684\u811a\u672c\u7a0b\u5e8f\u8fd0\u884c\u8d77\u6765\u4e86\u3002<\/p>\n<p>\u5f53\u7136&#xff0c;\u4e0a\u9762\u53ea\u662f\u8fd0\u884c\u4f60\u7684\u811a\u672c\u800c\u5df2&#xff0c;\u8981\u6302\u5728\u670d\u52a1\u5668\u540e\u53f0\u8fd0\u884c\u7684\u8bdd\u4f7f\u7528\u4e0b\u9762\u8fd9\u4e2a\u547d\u4ee4:<\/p>\n<p><span class=\"token function\">nohup<\/span> python3 auto_quote.py <span class=\"token operator\">&gt;<\/span>\/dev\/null <span class=\"token operator\"><span class=\"token file-descriptor important\">2<\/span>&gt;<\/span><span class=\"token file-descriptor important\">&amp;1<\/span> <\/p>\n<p>\u4ee5\u4e0b\u662f\u8fd9\u4e2a\u547d\u4ee4\u7684\u4f5c\u7528&#xff1a;<\/p>\n<p>nohup&#xff1a;\u4f7f\u547d\u4ee4\u5ffd\u7565\u6302\u8d77&#xff08;hangup&#xff09;\u4fe1\u53f7&#xff0c;\u8fd9\u610f\u5473\u7740\u5373\u4f7f\u7ec8\u7aef\u5173\u95ed&#xff0c;\u547d\u4ee4\u4e5f\u4f1a\u7ee7\u7eed\u5728\u540e\u53f0\u8fd0\u884c\u3002<\/p>\n<p>python3 crawl_news.py&#xff1a;\u8fd0\u884c\u4f60\u7684 Python \u811a\u672c\u3002<\/p>\n<p>&gt;\/dev\/null 2&gt;&amp;1&#xff1a;\u5c06\u6807\u51c6\u8f93\u51fa\u548c\u6807\u51c6\u9519\u8bef\u8f93\u51fa\u91cd\u5b9a\u5411\u5230\/dev\/null&#xff0c;\u5373\u4e22\u5f03\u6240\u6709\u8f93\u51fa&#xff0c;\u4e0d\u8f93\u51fa\u5230\u7ec8\u7aef\u3002<\/p>\n<p>&amp;&#xff1a;\u5c06\u547d\u4ee4\u653e\u5728\u540e\u53f0\u8fd0\u884c\u3002<\/p>\n<p>\u7136\u800c&#xff0c;\u8fd9\u5e76\u4e0d\u662f\u7edd\u5bf9\u4fdd\u8bc1\u811a\u672c\u4e00\u76f4\u542f\u52a8\u7740&#xff0c;\u53ef\u80fd\u51fa\u73b0\u7684\u60c5\u51b5\u6709&#xff1a;<\/p>\n<p>\u811a\u672c\u4e2d\u5b58\u5728\u9519\u8bef&#xff0c;\u53ef\u80fd\u5bfc\u81f4\u811a\u672c\u610f\u5916\u9000\u51fa\u3002 \u7cfb\u7edf\u8d44\u6e90\u4e0d\u8db3\u3001\u88ab\u7ba1\u7406\u5458\u7ec8\u6b62\u8fdb\u7a0b\u7b49\u60c5\u51b5\u4e5f\u53ef\u80fd\u5bfc\u81f4\u811a\u672c\u505c\u6b62\u8fd0\u884c\u3002<\/p>\n<p>\u4f60\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u67e5\u770b\u8fd0\u884c\u811a\u672c\u6240\u5360\u7528\u7684\u8fdb\u7a0bID:<\/p>\n<p><span class=\"token function\">ps<\/span> aux <span class=\"token operator\">|<\/span> <span class=\"token function\">grep<\/span> auto_quote.py <\/p>\n<p>\u5927\u6982\u5185\u5bb9\u5c31\u662f\u4e0a\u9762\u8fd9\u4e9b&#xff0c;\u4e0d\u61c2\u53ef\u4ee5\u79c1\u4fe1\u6211\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb1.2k\u6b21\uff0c\u70b9\u8d5e18\u6b21\uff0c\u6536\u85cf28\u6b21\u3002py\u811a\u672c\u90e8\u7f72\u5230\u670d\u52a1\u5668\u5b9a\u65f6\u542f\u52a8_\u5982\u4f55\u5c06\u811a\u672c\u90e8\u7f72\u5230\u670d\u52a1\u5668\u4e0a?<\/p>\n","protected":false},"author":2,"featured_media":25511,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[100,43,2010,44],"topic":[],"class_list":["post-25512","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-server","tag-100","tag-43","tag-2010","tag-44"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>py\u811a\u672c\u90e8\u7f72\u5230\u670d\u52a1\u5668\u5b9a\u65f6\u542f\u52a8 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wsisp.com\/helps\/25512.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"py\u811a\u672c\u90e8\u7f72\u5230\u670d\u52a1\u5668\u5b9a\u65f6\u542f\u52a8 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb1.2k\u6b21\uff0c\u70b9\u8d5e18\u6b21\uff0c\u6536\u85cf28\u6b21\u3002py\u811a\u672c\u90e8\u7f72\u5230\u670d\u52a1\u5668\u5b9a\u65f6\u542f\u52a8_\u5982\u4f55\u5c06\u811a\u672c\u90e8\u7f72\u5230\u670d\u52a1\u5668\u4e0a?\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/25512.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2025-04-19T04:46:51+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250419044650-68032aba8a1d3.png\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/25512.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/25512.html\",\"name\":\"py\u811a\u672c\u90e8\u7f72\u5230\u670d\u52a1\u5668\u5b9a\u65f6\u542f\u52a8 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2025-04-19T04:46:51+00:00\",\"dateModified\":\"2025-04-19T04:46:51+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/25512.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/25512.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/25512.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"py\u811a\u672c\u90e8\u7f72\u5230\u670d\u52a1\u5668\u5b9a\u65f6\u542f\u52a8\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\",\"url\":\"https:\/\/www.wsisp.com\/helps\/\",\"name\":\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"description\":\"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"contentUrl\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/wp.wsisp.com\"],\"url\":\"https:\/\/www.wsisp.com\/helps\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"py\u811a\u672c\u90e8\u7f72\u5230\u670d\u52a1\u5668\u5b9a\u65f6\u542f\u52a8 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.wsisp.com\/helps\/25512.html","og_locale":"zh_CN","og_type":"article","og_title":"py\u811a\u672c\u90e8\u7f72\u5230\u670d\u52a1\u5668\u5b9a\u65f6\u542f\u52a8 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb1.2k\u6b21\uff0c\u70b9\u8d5e18\u6b21\uff0c\u6536\u85cf28\u6b21\u3002py\u811a\u672c\u90e8\u7f72\u5230\u670d\u52a1\u5668\u5b9a\u65f6\u542f\u52a8_\u5982\u4f55\u5c06\u811a\u672c\u90e8\u7f72\u5230\u670d\u52a1\u5668\u4e0a?","og_url":"https:\/\/www.wsisp.com\/helps\/25512.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2025-04-19T04:46:51+00:00","og_image":[{"url":"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250419044650-68032aba8a1d3.png"}],"author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"2 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/25512.html","url":"https:\/\/www.wsisp.com\/helps\/25512.html","name":"py\u811a\u672c\u90e8\u7f72\u5230\u670d\u52a1\u5668\u5b9a\u65f6\u542f\u52a8 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2025-04-19T04:46:51+00:00","dateModified":"2025-04-19T04:46:51+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/25512.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/25512.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/25512.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"py\u811a\u672c\u90e8\u7f72\u5230\u670d\u52a1\u5668\u5b9a\u65f6\u542f\u52a8"}]},{"@type":"WebSite","@id":"https:\/\/www.wsisp.com\/helps\/#website","url":"https:\/\/www.wsisp.com\/helps\/","name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","description":"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41","name":"admin","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/","url":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","contentUrl":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","caption":"admin"},"sameAs":["http:\/\/wp.wsisp.com"],"url":"https:\/\/www.wsisp.com\/helps\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/25512","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/comments?post=25512"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/25512\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media\/25511"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=25512"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=25512"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=25512"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=25512"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}