{"id":639,"date":"2023-07-29T22:47:15","date_gmt":"2023-07-29T14:47:15","guid":{"rendered":"http:\/\/72.44.76.42\/?p=639"},"modified":"2023-07-29T22:49:51","modified_gmt":"2023-07-29T14:49:51","slug":"%e5%9c%a8vscode%e4%b8%8a%e4%bd%bf%e7%94%a8tensorflow%ef%bc%8c%e5%b9%b6%e5%90%af%e7%94%a8gpu%e8%ae%ad%e7%bb%83","status":"publish","type":"post","link":"https:\/\/www.notown.top\/?p=639","title":{"rendered":"\u5728vscode\u4e0a\u4f7f\u7528tensorflow\uff0c\u5e76\u542f\u7528GPU\u8bad\u7ec3"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\"><a href=\"https:\/\/code.visualstudio.com\/Download\" data-type=\"URL\" data-id=\"https:\/\/code.visualstudio.com\/Download\" target=\"_blank\" rel=\"noreferrer noopener\">1.\u5b89\u88c5vscode<\/a><br><a href=\"https:\/\/www.python.org\/downloads\/\" data-type=\"URL\" data-id=\"https:\/\/www.python.org\/downloads\/\" target=\"_blank\" rel=\"noreferrer noopener\">2.\u5b89\u88c5python<\/a><\/h2>\n\n\n\n<p>\u5b89\u88c5<strong>python\u7684\u7248\u672c\u5efa\u8bae\u4e3a3.8\u548c3.9<\/strong>\uff083.7\u597d\u50cf\u4e5f\u884c\uff09\uff0c\u56e0\u4e3a\u540e\u7eed\u5982\u679c\u8981\u5728\u672c\u5730window\u7cfb\u7edf\u4e0a\u8bad\u7ec3\uff0ctensorflow2.10\u540e\u7684\u7248\u672c\u5e76\u4e0d\u76f4\u63a5\u652f\u6301\uff0c\u5373\u80fd<strong>\u5728\u672c\u5730window\u4e0a\u8dd1tensorflow\u7684\u6700\u9ad8\u7248\u672c\u4e3a2.10<\/strong>\uff0c\u4f46\u662f2.10\u7248\u672c\u7684tensorflow\u53ea\u80fd\u88abpython3.7,3.8,3.9\u4f7f\u7528<\/p>\n\n\n\n<p>\u5b89\u88c5python\u65f6\uff0c\u8bb0\u5f97\u52fe\u9009\u4e0a\u628a\u6dfb\u52a0\u73af\u5883\u53d8\u91cf\u7ed9\u52fe\u4e0a\uff08\u5982\uff1aadd python3.9 to PATH\uff09\uff0c\u5426\u5219\u5c31\u8981\u81ea\u5df1\u6253\u5f00\u7cfb\u7edf\u73af\u5883\u53d8\u91cf\u6dfb\u52a0<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">3.\u914d\u7f6eVScode<\/h2>\n\n\n\n<ul class=\"wp-block-list\"><li>\u5728 VS Code \u7684\u5e94\u7528\u5546\u5e97\uff08\u5feb\u6377\u952e\uff1aCtrl + Shift + X\uff09\u91cc\u641c\u7d22 Python \u63d2\u4ef6\uff0c\u5e76\u5b89\u88c5<\/li><li>\u6309 Ctrl + Shift + P\uff08\u6216F1\uff09\uff0c\u5728\u6253\u5f00\u7684\u8f93\u5165\u6846\u4e2d\u8f93\u5165&nbsp;<code>Python: Select Interpreter<\/code>&nbsp;\u641c\u7d22\uff0c\u9009\u62e9 Python \u89e3\u6790\u5668<\/li><\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">4.\u5b89\u88c5tensorflow<\/h2>\n\n\n\n<p>\u5728\u547d\u4ee4\u884c\u91cc\uff0c\u8c03\u7528<code>pip install tensorflow==2.10.0<\/code>\uff0c\u4e5f\u53ef\u4ee5\u4f7f\u7528\u56fd\u5185\u7684\u955c\u50cf\u6e90\u6765\u88c5<code>pip install tensorflow==2.10.0 -i https:\/\/pypi.tuna.tsinghua.edu.cn\/simple<\/code><\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><a href=\"https:\/\/developer.nvidia.com\/cuda-toolkit-archive\" data-type=\"URL\" data-id=\"https:\/\/developer.nvidia.com\/cuda-toolkit-archive\" target=\"_blank\" rel=\"noreferrer noopener\">5.\u5b89\u88c5cuda\u5de5\u5177\u5305<\/a><\/h2>\n\n\n\n<p>\u5b89\u88c511.2\u7248\u672c\u7684<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><a href=\"https:\/\/developer.nvidia.com\/rdp\/cudnn-archive\" data-type=\"URL\" data-id=\"https:\/\/developer.nvidia.com\/rdp\/cudnn-archive\" target=\"_blank\" rel=\"noreferrer noopener\">6.\u5b89\u88c5cuDNN<\/a><\/h2>\n\n\n\n<p>\u5b89\u88c5\u8fd9\u4e2a\u9700\u8981\u5148\u6ce8\u518c\u6210\u4e3a\u5f00\u53d1\u8005\uff0c\u662f\u514d\u8d39\u7684\u3002<br>\u5b89\u88c58.1\u7248\u672c\u7684\uff0c\u8fd9\u4e2a\u5b89\u88c5\u5b8c\u540e\uff0c\u8981\u628abin\u76ee\u8def\u6dfb\u52a0\u5230\u7cfb\u7edf\u73af\u5883\u53d8\u91cf\u91cc<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">7.\u6d4b\u8bd5<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>import tensorflow as tf\n\nprint(tf.test.is_gpu_available())<\/code><\/pre>\n\n\n\n<p>\u82e5\u80fd\u6253\u5370\u51fatrue\uff0c\u5219\u53ef\u4ee5\u6210\u529f\u4f7f\u7528gpu\u6765\u8bad\u7ec3<\/p>\n","protected":false},"excerpt":{"rendered":"<p>1.\u5b89\u88c5vscode2.\u5b89\u88c5python \u5b89\u88c5python\u7684\u7248\u672c\u5efa\u8bae\u4e3a3.8\u548c3.9\uff083.7\u597d\u50cf\u4e5f\u884c\uff09\uff0c\u56e0\u4e3a\u540e&hellip;<a href=\"https:\/\/www.notown.top\/?p=639\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">\u5728vscode\u4e0a\u4f7f\u7528tensorflow\uff0c\u5e76\u542f\u7528GPU\u8bad\u7ec3<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_import_markdown_pro_load_document_selector":0,"_import_markdown_pro_submit_text_textarea":"","footnotes":""},"categories":[19],"tags":[],"class_list":["post-639","post","type-post","status-publish","format-standard","hentry","category-19"],"_links":{"self":[{"href":"https:\/\/www.notown.top\/index.php?rest_route=\/wp\/v2\/posts\/639","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.notown.top\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.notown.top\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.notown.top\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.notown.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=639"}],"version-history":[{"count":4,"href":"https:\/\/www.notown.top\/index.php?rest_route=\/wp\/v2\/posts\/639\/revisions"}],"predecessor-version":[{"id":643,"href":"https:\/\/www.notown.top\/index.php?rest_route=\/wp\/v2\/posts\/639\/revisions\/643"}],"wp:attachment":[{"href":"https:\/\/www.notown.top\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=639"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.notown.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=639"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.notown.top\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=639"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}