{"id":48519,"date":"2025-07-30T12:22:27","date_gmt":"2025-07-30T04:22:27","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/48519.html"},"modified":"2025-07-30T12:22:27","modified_gmt":"2025-07-30T04:22:27","slug":"%e6%9c%8d%e5%8a%a1%e5%99%a8%e6%80%8e%e4%b9%88%e8%b7%91python%e9%a1%b9%e7%9b%ae%ef%bc%9f","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/48519.html","title":{"rendered":"\u670d\u52a1\u5668\u600e\u4e48\u8dd1Python\u9879\u76ee\uff1f"},"content":{"rendered":"<p>\u5728\u670d\u52a1\u5668\u4e0a\u8fd0\u884c Python \u9879\u76ee\u901a\u5e38\u6d89\u53ca\u00a0\u73af\u5883\u914d\u7f6e\u3001\u4f9d\u8d56\u5b89\u88c5\u3001\u9879\u76ee\u90e8\u7f72\u00a0\u548c\u00a0\u8fdb\u7a0b\u7ba1\u7406\u3002\u4ee5\u4e0b\u662f\u8be6\u7ec6\u6b65\u9aa4&#xff1a;<\/p>\n<hr \/>\n<h3>1. \u8fde\u63a5\u670d\u52a1\u5668<\/h3>\n<p>\u786e\u4fdd\u4f60\u80fd\u901a\u8fc7 SSH \u8bbf\u95ee\u670d\u52a1\u5668&#xff1a;<\/p>\n<p>ssh username&#064;your_server_ip<\/p>\n<p>&#xff08;\u5982\u679c\u662f\u672c\u5730\u6d4b\u8bd5&#xff0c;\u53ef\u8df3\u8fc7\u8fd9\u4e00\u6b65&#xff09;<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/07\/20250730042225-68899e01c83de.png\" \/><\/p>\n<hr \/>\n<h3>2. \u5b89\u88c5 Python \u73af\u5883<\/h3>\n<h4>2.1 \u68c0\u67e5 Python \u7248\u672c<\/h4>\n<p>python3 &#8211;version  # \u6216 python &#8211;version<\/p>\n<ul>\n<li>\n<p>\u5982\u679c\u672a\u5b89\u88c5 Python 3&#xff08;\u63a8\u8350 3.8&#043;&#xff09;&#xff0c;\u4f7f\u7528\u5305\u7ba1\u7406\u5668\u5b89\u88c5&#xff1a;<\/p>\n<ul>\n<li>\n<p>Ubuntu\/Debian&#xff1a;<\/p>\n<p>sudo apt update<br \/>\nsudo apt install python3 python3-pip python3-venv\n<\/li>\n<li>\n<p>CentOS\/RHEL&#xff1a;<\/p>\n<p>sudo yum install python3 python3-pip\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<h4>2.2 \u53ef\u9009&#xff1a;\u4f7f\u7528 Pyenv \u7ba1\u7406\u591a\u7248\u672c<\/h4>\n<p>\u5982\u679c\u9700\u8981\u7279\u5b9a Python \u7248\u672c&#xff1a;<\/p>\n<p>curl https:\/\/pyenv.run | bash  # \u5b89\u88c5 Pyenv<br \/>\necho &#039;export PATH&#061;&#034;$HOME\/.pyenv\/bin:$PATH&#034;&#039; &gt;&gt; ~\/.bashrc<br \/>\necho &#039;eval &#034;$(pyenv init &#8211;path)&#034;&#039; &gt;&gt; ~\/.bashrc<br \/>\necho &#039;eval &#034;$(pyenv virtualenv-init -)&#034;&#039; &gt;&gt; ~\/.bashrc<br \/>\nsource ~\/.bashrc<br \/>\npyenv install 3.10.6          # \u5b89\u88c5\u6307\u5b9a\u7248\u672c<br \/>\npyenv global 3.10.6           # \u8bbe\u4e3a\u9ed8\u8ba4<\/p>\n<hr \/>\n<h3>3. \u914d\u7f6e\u865a\u62df\u73af\u5883&#xff08;\u63a8\u8350&#xff09;<\/h3>\n<p>\u907f\u514d\u5168\u5c40\u4f9d\u8d56\u51b2\u7a81&#xff1a;<\/p>\n<p>python3 -m venv myprojectenv  # \u521b\u5efa\u865a\u62df\u73af\u5883<br \/>\nsource myprojectenv\/bin\/activate  # \u6fc0\u6d3b&#xff08;Linux\/macOS&#xff09;<br \/>\n# Windows: myprojectenv\\\\Scripts\\\\activate<\/p>\n<p>\u6fc0\u6d3b\u540e&#xff0c;\u7ec8\u7aef\u63d0\u793a\u7b26\u4f1a\u663e\u793a\u00a0(myprojectenv)\u3002<\/p>\n<hr \/>\n<h3>4. \u5b89\u88c5\u9879\u76ee\u4f9d\u8d56<\/h3>\n<h4>4.1 \u4f7f\u7528\u00a0requirements.txt<\/h4>\n<p>\u5982\u679c\u9879\u76ee\u6709\u00a0requirements.txt&#xff1a;<\/p>\n<p>pip install -r requirements.txt<\/p>\n<h4>4.2 \u624b\u52a8\u5b89\u88c5\u4f9d\u8d56<\/h4>\n<p>pip install flask django pandas  # \u793a\u4f8b<\/p>\n<hr \/>\n<h3>5. \u8fd0\u884c Python \u9879\u76ee<\/h3>\n<h4>5.1 \u76f4\u63a5\u8fd0\u884c\u811a\u672c<\/h4>\n<p>python3 app.py  # \u66ff\u6362\u4e3a\u4f60\u7684\u5165\u53e3\u6587\u4ef6<\/p>\n<h4>5.2 Web \u9879\u76ee&#xff08;\u5982 Flask\/Django&#xff09;<\/h4>\n<ul>\n<li>\n<p>Flask&#xff1a;<\/p>\n<p>export FLASK_APP&#061;app.py  # \u8bbe\u7f6e\u73af\u5883\u53d8\u91cf<br \/>\nflask run &#8211;host&#061;0.0.0.0 &#8211;port&#061;5000  # \u5141\u8bb8\u5916\u90e8\u8bbf\u95ee\n<\/li>\n<li>\n<p>Django&#xff1a;<\/p>\n<p>python manage.py runserver 0.0.0.0:8000\n<\/li>\n<\/ul>\n<p>\u26a0\ufe0f\u00a0\u6ce8\u610f&#xff1a;\u4ee5\u4e0a\u65b9\u5f0f\u4ec5\u9002\u5408\u5f00\u53d1\u73af\u5883&#xff01;\u751f\u4ea7\u73af\u5883\u9700\u7528\u00a0Gunicorn\/uWSGI &#043; Nginx&#xff08;\u89c1\u4e0b\u6587&#xff09;\u3002<\/p>\n<hr \/>\n<h3>6. \u751f\u4ea7\u73af\u5883\u90e8\u7f72&#xff08;\u5173\u952e\u6b65\u9aa4&#xff09;<\/h3>\n<h4>6.1 \u4f7f\u7528 Gunicorn&#xff08;WSGI \u670d\u52a1\u5668&#xff09;<\/h4>\n<p>\u5b89\u88c5 Gunicorn&#xff1a;<\/p>\n<p>pip install gunicorn<\/p>\n<p>\u8fd0\u884c Flask\/Django \u9879\u76ee&#xff1a;<\/p>\n<p># Flask<br \/>\ngunicorn -w 4 -b 0.0.0.0:8000 app:app  # app:app \u8868\u793a\u6a21\u5757\u540d:\u5e94\u7528\u5b9e\u4f8b<\/p>\n<p># Django<br \/>\ngunicorn -w 4 -b 0.0.0.0:8000 myproject.wsgi:application<\/p>\n<ul>\n<li>\n<p>-w 4&#xff1a;4 \u4e2a\u5de5\u4f5c\u8fdb\u7a0b&#xff08;\u6839\u636e CPU \u6838\u5fc3\u6570\u8c03\u6574&#xff09;\u3002<\/p>\n<\/li>\n<\/ul>\n<h4>6.2 \u914d\u7f6e Nginx \u53cd\u5411\u4ee3\u7406<\/h4>\n<p>\u5b89\u88c5 Nginx&#xff1a;<\/p>\n<p>sudo apt install nginx<\/p>\n<p>\u7f16\u8f91\u914d\u7f6e\u6587\u4ef6&#xff08;\/etc\/nginx\/sites-available\/myproject&#xff09;&#xff1a;<\/p>\n<p>nginx<\/p>\n<p>server {<br \/>\n    listen 80;<br \/>\n    server_name your_domain.com;<\/p>\n<p>    location \/ {<br \/>\n        proxy_pass http:\/\/127.0.0.1:8000;  # \u8f6c\u53d1\u5230 Gunicorn<br \/>\n        proxy_set_header Host $host;<br \/>\n        proxy_set_header X-Real-IP $remote_addr;<br \/>\n    }<br \/>\n}<\/p>\n<p>\u542f\u7528\u914d\u7f6e\u5e76\u91cd\u542f Nginx&#xff1a;<\/p>\n<p>sudo ln -s \/etc\/nginx\/sites-available\/myproject \/etc\/nginx\/sites-enabled<br \/>\nsudo nginx -t  # \u6d4b\u8bd5\u8bed\u6cd5<br \/>\nsudo systemctl restart nginx<\/p>\n<h4>6.3 \u4f7f\u7528 Systemd \u7ba1\u7406\u8fdb\u7a0b<\/h4>\n<p>\u521b\u5efa Systemd \u670d\u52a1\u6587\u4ef6&#xff08;\/etc\/systemd\/system\/myproject.service&#xff09;&#xff1a;<\/p>\n<p>ini<\/p>\n<p>[Unit]<br \/>\nDescription&#061;Gunicorn for my Python project<br \/>\nAfter&#061;network.target<\/p>\n<p>[Service]<br \/>\nUser&#061;ubuntu<br \/>\nWorkingDirectory&#061;\/path\/to\/your\/project<br \/>\nExecStart&#061;\/path\/to\/venv\/bin\/gunicorn -w 4 -b 127.0.0.1:8000 app:app<br \/>\nRestart&#061;always<\/p>\n<p>[Install]<br \/>\nWantedBy&#061;multi-user.target<\/p>\n<p>\u542f\u52a8\u670d\u52a1&#xff1a;<\/p>\n<p>sudo systemctl daemon-reload<br \/>\nsudo systemctl start myproject<br \/>\nsudo systemctl enable myproject  # \u5f00\u673a\u81ea\u542f<\/p>\n<hr \/>\n<h3>7. \u5176\u4ed6\u4f18\u5316<\/h3>\n<h4>7.1 \u4f7f\u7528 Supervisor&#xff08;\u66ff\u4ee3 Systemd&#xff09;<\/h4>\n<p>\u9002\u5408\u7ba1\u7406\u591a\u4e2a\u8fdb\u7a0b&#xff1a;<\/p>\n<p>sudo apt install supervisor<\/p>\n<p>\u914d\u7f6e&#xff08;\/etc\/supervisor\/conf.d\/myproject.conf&#xff09;&#xff1a;<\/p>\n<p>ini<\/p>\n<p>[program:myproject]<br \/>\ncommand&#061;\/path\/to\/venv\/bin\/gunicorn -w 4 -b 127.0.0.1:8000 app:app<br \/>\ndirectory&#061;\/path\/to\/project<br \/>\nuser&#061;ubuntu<br \/>\nautostart&#061;true<br \/>\nautorestart&#061;true<br \/>\nstderr_logfile&#061;\/var\/log\/myproject.err.log<br \/>\nstdout_logfile&#061;\/var\/log\/myproject.out.log<\/p>\n<p>\u542f\u52a8&#xff1a;<\/p>\n<p>bash<\/p>\n<p>sudo supervisorctl reread<br \/>\nsudo supervisorctl update<br \/>\nsudo supervisorctl start myproject<\/p>\n<h4>7.2 HTTPS \u914d\u7f6e&#xff08;Certbot&#xff09;<\/h4>\n<p>sudo apt install certbot python3-certbot-nginx<br \/>\nsudo certbot &#8211;nginx -d your_domain.com<\/p>\n<p>\u8bc1\u4e66\u4f1a\u81ea\u52a8\u7eed\u7b7e\u3002<\/p>\n<hr \/>\n<h3>8. \u5e38\u89c1\u95ee\u9898<\/h3>\n<h4>Q1&#xff1a;\u7aef\u53e3\u88ab\u5360\u7528&#xff1f;<\/h4>\n<p>sudo lsof -i :8000  # \u67e5\u770b\u5360\u7528\u8fdb\u7a0b<br \/>\nsudo kill -9 &lt;PID&gt;  # \u5f3a\u5236\u7ed3\u675f<\/p>\n<h4>Q2&#xff1a;\u5982\u4f55\u67e5\u770b\u65e5\u5fd7&#xff1f;<\/h4>\n<ul>\n<li>\n<p>Gunicorn \u65e5\u5fd7&#xff1a;journalctl -u myproject.service<\/p>\n<\/li>\n<li>\n<p>Nginx \u65e5\u5fd7&#xff1a;\/var\/log\/nginx\/error.log<\/p>\n<\/li>\n<\/ul>\n<h4>Q3&#xff1a;\u9759\u6001\u6587\u4ef6&#xff08;CSS\/JS&#xff09;\u4e0d\u52a0\u8f7d&#xff1f;<\/h4>\n<p>\u5728 Nginx \u914d\u7f6e\u4e2d\u6dfb\u52a0&#xff1a;<\/p>\n<p>nginx<\/p>\n<p>location \/static\/ {<br \/>\n    alias \/path\/to\/your\/static\/files\/;<br \/>\n}<\/p>\n<p>Django \u9700\u8fd0\u884c&#xff1a;<\/p>\n<p>bash<\/p>\n<p>python manage.py collectstatic<\/p>\n<hr \/>\n<p>\u6309\u7167\u4ee5\u4e0a\u6b65\u9aa4&#xff0c;\u4f60\u7684 Python \u9879\u76ee\u5e94\u8be5\u80fd\u5728\u670d\u52a1\u5668\u4e0a\u7a33\u5b9a\u8fd0\u884c\u3002\u5982\u679c\u662f\u9ad8\u6d41\u91cf\u573a\u666f&#xff0c;\u53ef\u8fdb\u4e00\u6b65\u4f18\u5316&#xff1a;<\/p>\n<ul>\n<li>\n<p>\u4f7f\u7528\u00a0Docker\u00a0\u5bb9\u5668\u5316\u90e8\u7f72\u3002<\/p>\n<\/li>\n<li>\n<p>\u914d\u7f6e\u00a0Redis\u00a0\u7f13\u5b58\u6216\u00a0Celery\u00a0\u5f02\u6b65\u4efb\u52a1\u3002<\/p>\n<\/li>\n<li>\n<p>\u4f7f\u7528\u00a0PM2&#xff08;Node.js \u5de5\u5177&#xff09;\u7ba1\u7406 Python \u8fdb\u7a0b&#xff08;\u975e\u4e3b\u6d41\u4f46\u53ef\u884c&#xff09;\u3002<\/p>\n<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb900\u6b21\uff0c\u70b9\u8d5e13\u6b21\uff0c\u6536\u85cf27\u6b21\u3002gunicorn -w 4 -b 0.0.0.0:8000 app:app  # app:app \u8868\u793a\u6a21\u5757\u540d:\u5e94\u7528\u5b9e\u4f8b\u3002# \u8f6c\u53d1\u5230 Gunicorn\u3002source myprojectenv\/bin\/activate  # \u6fc0\u6d3b\uff08Linux\/macOS\uff09flask run &#8211;host=0.0.0.0 &#8211;port=5000  # \u5141\u8bb8\u5916\u90e8\u8bbf\u95ee\u3002curl https:\/\/pyenv.run | bash  # \u5b89\u88c5 Pyenv\u3002python3 &#8211;version  # \u6216 python &#8211;version\u3002_\u670d\u52a1\u5668\u5982\u4f55\u6267\u884cpytgon<\/p>\n","protected":false},"author":2,"featured_media":48518,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[58,81,97,43,44],"topic":[],"class_list":["post-48519","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-server","tag-linux","tag-python","tag-97","tag-43","tag-44"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>\u670d\u52a1\u5668\u600e\u4e48\u8dd1Python\u9879\u76ee\uff1f - \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\/48519.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u670d\u52a1\u5668\u600e\u4e48\u8dd1Python\u9879\u76ee\uff1f - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb900\u6b21\uff0c\u70b9\u8d5e13\u6b21\uff0c\u6536\u85cf27\u6b21\u3002gunicorn -w 4 -b 0.0.0.0:8000 app:app # app:app \u8868\u793a\u6a21\u5757\u540d:\u5e94\u7528\u5b9e\u4f8b\u3002# \u8f6c\u53d1\u5230 Gunicorn\u3002source myprojectenv\/bin\/activate # \u6fc0\u6d3b\uff08Linux\/macOS\uff09flask run --host=0.0.0.0 --port=5000 # \u5141\u8bb8\u5916\u90e8\u8bbf\u95ee\u3002curl https:\/\/pyenv.run | bash # \u5b89\u88c5 Pyenv\u3002python3 --version # \u6216 python --version\u3002_\u670d\u52a1\u5668\u5982\u4f55\u6267\u884cpytgon\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/48519.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2025-07-30T04:22:27+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/07\/20250730042225-68899e01c83de.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\/48519.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/48519.html\",\"name\":\"\u670d\u52a1\u5668\u600e\u4e48\u8dd1Python\u9879\u76ee\uff1f - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2025-07-30T04:22:27+00:00\",\"dateModified\":\"2025-07-30T04:22:27+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/48519.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/48519.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/48519.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"\u670d\u52a1\u5668\u600e\u4e48\u8dd1Python\u9879\u76ee\uff1f\"}]},{\"@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":"\u670d\u52a1\u5668\u600e\u4e48\u8dd1Python\u9879\u76ee\uff1f - \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\/48519.html","og_locale":"zh_CN","og_type":"article","og_title":"\u670d\u52a1\u5668\u600e\u4e48\u8dd1Python\u9879\u76ee\uff1f - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb900\u6b21\uff0c\u70b9\u8d5e13\u6b21\uff0c\u6536\u85cf27\u6b21\u3002gunicorn -w 4 -b 0.0.0.0:8000 app:app # app:app \u8868\u793a\u6a21\u5757\u540d:\u5e94\u7528\u5b9e\u4f8b\u3002# \u8f6c\u53d1\u5230 Gunicorn\u3002source myprojectenv\/bin\/activate # \u6fc0\u6d3b\uff08Linux\/macOS\uff09flask run --host=0.0.0.0 --port=5000 # \u5141\u8bb8\u5916\u90e8\u8bbf\u95ee\u3002curl https:\/\/pyenv.run | bash # \u5b89\u88c5 Pyenv\u3002python3 --version # \u6216 python --version\u3002_\u670d\u52a1\u5668\u5982\u4f55\u6267\u884cpytgon","og_url":"https:\/\/www.wsisp.com\/helps\/48519.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2025-07-30T04:22:27+00:00","og_image":[{"url":"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/07\/20250730042225-68899e01c83de.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\/48519.html","url":"https:\/\/www.wsisp.com\/helps\/48519.html","name":"\u670d\u52a1\u5668\u600e\u4e48\u8dd1Python\u9879\u76ee\uff1f - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2025-07-30T04:22:27+00:00","dateModified":"2025-07-30T04:22:27+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/48519.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/48519.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/48519.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"\u670d\u52a1\u5668\u600e\u4e48\u8dd1Python\u9879\u76ee\uff1f"}]},{"@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\/48519","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=48519"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/48519\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media\/48518"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=48519"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=48519"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=48519"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=48519"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}