{"id":346,"date":"2024-05-05T04:53:18","date_gmt":"2024-05-04T20:53:18","guid":{"rendered":"https:\/\/669082.xyz\/?p=346"},"modified":"2024-05-05T05:09:35","modified_gmt":"2024-05-04T21:09:35","slug":"20240505%e5%ad%a6%e4%b9%a0python_scrapy%e6%a1%86%e6%9e%b6_%e5%9f%ba%e7%a1%80","status":"publish","type":"post","link":"https:\/\/669082.xyz\/index.php\/2024\/05\/05\/20240505%e5%ad%a6%e4%b9%a0python_scrapy%e6%a1%86%e6%9e%b6_%e5%9f%ba%e7%a1%80\/","title":{"rendered":"20240505\u5b66\u4e60python_scrapy\u6846\u67b6_\u57fa\u7840"},"content":{"rendered":"<h5>1.\u5b89\u88c5scrapy<\/h5>\n<pre><code class=\"language-python\">pip install Scrapy<\/code><\/pre>\n<h5>2.\u521b\u5efa\u4e00\u4e2a\u9879\u76ee<\/h5>\n<pre><code class=\"language-python\">scrapy startproject mySpider<\/code><\/pre>\n<h5>3.\u8fdb\u5165\u9879\u76ee \u5e76 \u521b\u5efa\u4e00\u53ea\u722c\u866b<\/h5>\n<pre><code class=\"language-python\">scrapy genspider itcast &quot;itcast.cn&quot;<\/code><\/pre>\n<h5>4.\u5173\u4e8epython\u865a\u62df\u73af\u5883<\/h5>\n<h6>Pycharm\u65e0\u6cd5\u52a0\u8f7d\u6587\u4ef6 xx\\Scripts\\Activate.ps1\uff0c\u56e0\u4e3a\u5728\u6b64\u7cfb\u7edf\u4e0a\u7981\u6b62\u8fd0\u884c\u811a\u672c<\/h6>\n<h6>\u8fd9\u65f6\u5019\u9700\u8981\u7528\u7ba1\u7406\u5458\u65b9\u5f0f\u6253\u5f00powershell \u7136\u540e\u6267\u884c<\/h6>\n<pre><code class=\"language-shell\">set-ExecutionPolicy RemoteSigned<\/code><\/pre>\n<h6>python\u865a\u62df\u73af\u5883\u4e0b \u751f\u6210 requirements.txt (\u4e5f\u53ef\u7528\u4e8e\u975e\u865a\u62df\u73af\u5883)<\/h6>\n<pre><code class=\"language-python\">pip freeze &gt; requirements.txt<\/code><\/pre>\n<h6>\u4ecerequirements.txt\u5b89\u88c5\u4f9d\u8d56\u5e93<\/h6>\n<pre><code class=\"language-python\">pip install -r requirements.txt<\/code><\/pre>\n<h5>5.\u8fd0\u884c\u4e00\u53ea\u722c\u866b<\/h5>\n<pre><code class=\"language-python\">scrapy crawl itcast<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>1.\u5b89\u88c5scrapy pip install Scrapy 2.\u521b\u5efa\u4e00\u4e2a\u9879\u76ee scrapy star [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[10],"tags":[],"class_list":["post-346","post","type-post","status-publish","format-standard","hentry","category-python"],"_links":{"self":[{"href":"https:\/\/669082.xyz\/index.php\/wp-json\/wp\/v2\/posts\/346","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/669082.xyz\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/669082.xyz\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/669082.xyz\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/669082.xyz\/index.php\/wp-json\/wp\/v2\/comments?post=346"}],"version-history":[{"count":8,"href":"https:\/\/669082.xyz\/index.php\/wp-json\/wp\/v2\/posts\/346\/revisions"}],"predecessor-version":[{"id":354,"href":"https:\/\/669082.xyz\/index.php\/wp-json\/wp\/v2\/posts\/346\/revisions\/354"}],"wp:attachment":[{"href":"https:\/\/669082.xyz\/index.php\/wp-json\/wp\/v2\/media?parent=346"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/669082.xyz\/index.php\/wp-json\/wp\/v2\/categories?post=346"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/669082.xyz\/index.php\/wp-json\/wp\/v2\/tags?post=346"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}