{"id":187,"date":"2023-02-19T21:30:55","date_gmt":"2023-02-19T13:30:55","guid":{"rendered":"https:\/\/www.appblog.cn\/?p=187"},"modified":"2023-02-19T21:32:04","modified_gmt":"2023-02-19T13:32:04","slug":"python-deploy-http-server-use-pycharm-config-virtualenv-for-flask","status":"publish","type":"post","link":"https:\/\/www.appblog.cn\/index.php\/2023\/02\/19\/python-deploy-http-server-use-pycharm-config-virtualenv-for-flask\/","title":{"rendered":"Python\u642d\u5efaHTTP\u670d\u52a1\u5668\uff1aPyCharm\u914d\u7f6evirtualenv\u4f7f\u7528Flask"},"content":{"rendered":"<p>\u5982\u679c\u4f7f\u7528virtualenv\u5b89\u88c5Flask\uff0c\u4f46\u662f\u5728PyCharm\u521b\u5efaFlask\u9879\u76ee\u65f6\uff0cProject Interpreter \u5e76\u6ca1\u6709\u914d\u7f6e\u4e3a\u5e26\u6709Flask\u7684virtualenv\u865a\u62df\u73af\u5883\uff0c\u90a3\u4e48\u8fd0\u884c\u7684\u65f6\u5019\u4f1a\u62a5\u9519<\/p>\n<pre><code>from flask import Flask ImportError: No module named flask<\/code><\/pre>\n<p><!-- more --><\/p>\n<p>\u89e3\u51b3\u65b9\u6cd5\uff1a<\/p>\n<h3>\u6253\u5f00\u9879\u76ee\u7684Interpreter<\/h3>\n<p>\u6253\u5f00\u83dc\u5355 File -&gt; Settings -&gt; Project -&gt; Project Interpreter<\/p>\n<p>\u53ef\u4ee5\u770b\u5230\u5f53\u524dInterpreter\u5e76\u6ca1\u6709Flask\uff0c\u70b9\u51fb\u53f3\u4e0a\u89d2\u914d\u7f6e\u56fe\u6807\uff0c\u9009\u62e9Add Local<\/p>\n<p>![Project Interpreter_Add Local](<a target=\"_blank\" rel=\"noopener\" href=\"http:\/\/www.yezhou.me\/AppBlog\/images\/Python\/Project\">http:\/\/www.yezhou.me\/AppBlog\/images\/Python\/Project<\/a> Interpreter_Add Local.png)<\/p>\n<h3>\u9009\u62e9\u5305\u542bFlask\u7684Interpreter<\/h3>\n<p>\u9009\u62e9virtualenv\u865a\u62df\u73af\u5883\u76ee\u5f55\u4e0b\u7684Python.exe<\/p>\n<p>![Project Interpreter_\u9009\u62e9virtualenv\u76ee\u5f55\u4e0b\u7684Python.exe](<a target=\"_blank\" rel=\"noopener\" href=\"http:\/\/www.yezhou.me\/AppBlog\/images\/Python\/Project\">http:\/\/www.yezhou.me\/AppBlog\/images\/Python\/Project<\/a> Interpreter_\u9009\u62e9virtualenv\u76ee\u5f55\u4e0b\u7684Python.exe.png)<\/p>\n<h3>Project Interpreter\u914d\u7f6e\u4e3avirtualenv<\/h3>\n<p>\u53ef\u4ee5\u770b\u5230 Project Interpreter \u5df2\u7ecf\u53d8\u4e3a <code>virtualenv at C:\\tools\\myvir<\/code><\/p>\n<p>![Project Interpreter_virtualenv](<a target=\"_blank\" rel=\"noopener\" href=\"http:\/\/www.yezhou.me\/AppBlog\/images\/Python\/Project\">http:\/\/www.yezhou.me\/AppBlog\/images\/Python\/Project<\/a> Interpreter_virtualenv.png)<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5982\u679c\u4f7f\u7528virtualenv\u5b89\u88c5Flask\uff0c\u4f46\u662f\u5728PyCharm\u521b\u5efaFlask\u9879\u76ee\u65f6\uff0cProject Inte [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[79],"tags":[80],"class_list":["post-187","post","type-post","status-publish","format-standard","hentry","category-python","tag-flask"],"_links":{"self":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts\/187","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/comments?post=187"}],"version-history":[{"count":0,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts\/187\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/media?parent=187"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/categories?post=187"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/tags?post=187"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}