{"id":157252,"date":"2019-08-31T11:09:13","date_gmt":"2019-08-31T03:09:13","guid":{"rendered":"https:\/\/lrxjmw.cn\/?p=157252"},"modified":"2019-08-27T14:24:02","modified_gmt":"2019-08-27T06:24:02","slug":"ubuntu-18-tensorflowcpu","status":"publish","type":"post","link":"https:\/\/lrxjmw.cn\/ubuntu-18-tensorflowcpu.html","title":{"rendered":"\u6559\u4f60\u5982\u4f55\u5728Ubuntu 18.04 \u4e0b\u5b89\u88c5 Tensorflow(CPU)"},"content":{"rendered":"\n\n\n
\u5bfc\u8bfb<\/td>\n\u6700\u8fd1\u6211\u5f00\u59cb\u5b66\u4e60\u6df1\u5ea6\u5b66\u4e60\u6846\u67b6Tensorflow\uff0c\u4e00\u5f00\u59cb\u5728Windows\u5e73\u53f0\u4e0b\u7684anaconda\u4e0b\u5b89\u88c5\uff0c\u7531\u4e8eanaconda\u5b89\u88c5\u51e0\u6b21\u540enavigator\u6253\u5f00\u8001\u662f\u51fa\u73b0\u95ea\u9000\u7684\u95ee\u9898\uff0c\u6240\u4ee5\u51b3\u5b9a\u6362\u4e2aUbuntu\u4e0b\u7ee7\u7eed\u6298\u817etensorflow\u3002\u672c\u4eba\u7b14\u8bb0\u672c\u6ca1\u6709NVIDIA\u663e\u5361\uff0c\u53ea\u88c5\u7684CPU\u7248\u672c\u7684\u3002\u800c\u4e14\u662f\u5728\u865a\u62df\u673a\u4e0b\u7684\uff0c\u4e0b\u9762\u5f00\u59cb\u5427\u3002<\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n

\u5148\u5b89\u88c5\u597dUbuntu 18.04\u7248\u672c\u7684\u7cfb\u7edf\uff08\u6700\u597d\u662fUbuntu\u768414.04\u7248\u672c\u4ee5\u4e0a\uff09\uff0cUbuntu\u7cfb\u7edf\u5df2\u7ecf\u6709\u4e86\u4e86Python 3.7.7.7\uff0c\u6240\u4ee5\u4e0d\u9700\u8981\u518d\u5b89\u88c5Python\u4e86\u3002<\/p>\n

\u4e00\u3001\u9996\u5148\u66f4\u65b0\u6e90\u4e3a\u963f\u91cc\u4e91\u8f6f\u4ef6\u6e90\uff0c\u589e\u52a0\u4e0b\u8f7d\u901f\u5ea6<\/strong><\/div>\n
\uff081\uff09\u5907\u4efd\u5f53\u524d\u4e5f\u5c31\u662f\u9ed8\u8ba4\u5b98\u65b9\u7684\u6e90\u5217\u8868<\/strong><\/span><\/div>\n
sudo cp \/etc\/apt\/sources.list \/etc\/apt\/sources.list.backup<\/pre>\n
\uff082\uff09\u5220\u9664sources.list\u6587\u4ef6\u4e2d\u7684\u5217\u8868\uff0c\u5220\u9664\u5168\u90e8\u5185\u5bb9<\/strong><\/span><\/div>\n
sudo gedit \/etc\/apt\/sources.list1<\/pre>\n
\uff083\uff09\u66ff\u6362\u5185\u5bb9\u540e\uff0c\u4fdd\u5b58<\/strong><\/span><\/div>\n
deb http:\/\/mirrors.aliyun.com\/ubuntu\/ bionic main restricted universe multiverse\r\ndeb-src http:\/\/mirrors.aliyun.com\/ubuntu\/ bionic main restricted universe multiverse\r\ndeb http:\/\/mirrors.aliyun.com\/ubuntu\/ bionic-security main restricted universe multiverse\r\ndeb-src http:\/\/mirrors.aliyun.com\/ubuntu\/ bionic-security main restricted universe multiverse\r\ndeb http:\/\/mirrors.aliyun.com\/ubuntu\/ bionic-updates main restricted universe multiverse\r\ndeb-src http:\/\/mirrors.aliyun.com\/ubuntu\/ bionic-updates main restricted universe multiverse\r\ndeb http:\/\/mirrors.aliyun.com\/ubuntu\/ bionic-backports main restricted universe multiverse\r\ndeb-src http:\/\/mirrors.aliyun.com\/ubuntu\/ bionic-backports main restricted universe multiverse\r\ndeb http:\/\/mirrors.aliyun.com\/ubuntu\/ bionic-proposed main restricted universe multiverse\r\ndeb-src http:\/\/mirrors.aliyun.com\/ubuntu\/ bionic-proposed main restricted universe multiverse<\/pre>\n
\uff084\uff09\u66f4\u65b0\u6e90\u5217\u8868<\/strong><\/span><\/div>\n
sudo apt-get update<\/pre>\n

\u53c2\u8003\uff1ahttps:\/\/www.linuxidc.com\/Linux\/2019-04\/158157.htm<\/a><\/p>\n

\u4e8c\u3001\u5b89\u88c5Tensorflow\uff08Python3.6.7\/CPU\uff09<\/strong><\/div>\n
\uff081\uff09\u5b89\u88c5Python3\u7684\u5305\u7ba1\u7406pip<\/strong><\/span><\/div>\n
sudo apt-get install python3-pip python3-dev<\/pre>\n

\"\"<\/p>\n

\uff082\uff09\u5b89\u88c5tensorflow<\/strong><\/span><\/div>\n

\uff08\u81ea\u52a8\u5b89\u88c5\u76f8\u5173\u5e93numpy\u3001tensorboard\u3001six\u3001protobuf\u3001html5lib\u3001bleach\u3001werkzeug\u3001markdown\uff09<\/p>\n

linuxidc@linuxidc:~\/linuxidc.com$ sudo pip3 install tensorflow<\/pre>\n

\"\"<\/p>\n

\uff083\uff09\u6d4b\u8bd5tensorflow<\/strong><\/span><\/div>\n
linuxidc@linuxidc:~\/linuxidc.com$ python3\r\nPython 3.6.7 (default, Oct 22 2018, 11:32:17)\r\n[GCC 8.2.0] on linux\r\nType \"help\", \"copyright\", \"credits\" or \"license\" for more information.\r\n>>> import tensorflow as tf\r\n>>> a = tf.constant(1)\r\n>>> b = tf.constant(2)\r\n>>> op = a + b\r\n>>> sess = tf.Session()\r\n2019-06-02 06:35:29.407386: I tensorflow\/core\/platform\/cpu_feature_guard.cc:141] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA\r\n2019-06-02 06:35:29.427402: I tensorflow\/core\/platform\/profile_utils\/cpu_utils.cc:94] CPU Frequency: 1799995000 Hz\r\n2019-06-02 06:35:29.427627: I tensorflow\/compiler\/xla\/service\/service.cc:150] XLA service 0x24f1710 executing computations on platform Host. Devices:\r\n2019-06-02 06:35:29.427675: I tensorflow\/compiler\/xla\/service\/service.cc:158] StreamExecutor device (0): <undefined>, <undefined>\r\n>>> sess.run(op)\r\n3\r\n>>> sess.close()\r\n>>><\/pre>\n

\"\"<\/p>\n","protected":false},"excerpt":{"rendered":"

\u5148\u5b89\u88c5\u597dUbuntu 18.04\u7248\u672c\u7684\u7cfb\u7edf\uff08\u6700\u597d\u662fUbuntu\u768414.04\u7248\u672c\u4ee5\u4e0a\uff09\uff0cUbuntu\u7cfb\u7edf\u5df2\u7ecf\u6709\u4e86 […]<\/p>\n","protected":false},"author":63,"featured_media":157257,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[55],"tags":[],"class_list":["post-157252","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-thread"],"acf":[],"_links":{"self":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/157252","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/users\/63"}],"replies":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/comments?post=157252"}],"version-history":[{"count":2,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/157252\/revisions"}],"predecessor-version":[{"id":157302,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/157252\/revisions\/157302"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media\/157257"}],"wp:attachment":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media?parent=157252"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/categories?post=157252"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/tags?post=157252"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}