{"id":34877,"date":"2024-08-15T10:34:58","date_gmt":"2024-08-15T03:34:58","guid":{"rendered":"http:\/\/jupitek.maudemo.vip\/index.php\/2024\/08\/15\/installing-tensorflow-on-ubuntu-20-04\/"},"modified":"2024-08-15T10:34:58","modified_gmt":"2024-08-15T03:34:58","slug":"installing-tensorflow-on-ubuntu-20-04","status":"publish","type":"post","link":"https:\/\/jupitek.maudemo.vip\/index.php\/2024\/08\/15\/installing-tensorflow-on-ubuntu-20-04\/","title":{"rendered":"C\u00e0i \u0111\u1eb7t TensorFlow tr\u00ean Ubuntu 20.04"},"content":{"rendered":"<p><a href=\"https:\/\/www.tensorflow.org\/\" target=\"_blank\" rel=\"noreferrer noopener\"><em>TensorFlow<\/em><\/a>&nbsp;l\u00e0 m\u1ed9t th\u01b0 vi\u1ec7n ph\u1ea7n m\u1ec1m ngu\u1ed3n m\u1edf \u0111\u01b0\u1ee3c s\u1eed d\u1ee5ng cho m\u00e1y h\u1ecdc v\u00e0 \u0111\u1ec3 \u0111\u00e0o t\u1ea1o<em><a href=\"https:\/\/en.wikipedia.org\/wiki\/Deep_learning\" target=\"_blank\" rel=\"noreferrer noopener\">&nbsp;m\u1ea1ng n\u01a1-ron s\u00e2u<\/a><\/em>&nbsp;. Google \u0111\u00e3 ph\u00e1t tri\u1ec3n TensorFlow cho c\u1ea3 m\u1ee5c \u0111\u00edch nghi\u00ean c\u1ee9u v\u00e0 s\u1ea3n xu\u1ea5t, nh\u01b0ng hi\u1ec7n t\u1ea1i n\u00f3 \u0111\u01b0\u1ee3c ph\u00e1t h\u00e0nh theo gi\u1ea5y ph\u00e9p Apache. N\u00f3 c\u00f3 s\u1eb5n cho nhi\u1ec1u h\u1ec7 \u0111i\u1ec1u h\u00e0nh, bao g\u1ed3m c\u1ea3 c\u00e1c b\u1ea3n ph\u00e2n ph\u1ed1i Linux ph\u1ed5 bi\u1ebfn nh\u1ea5t. \u0110\u1ed1i v\u1edbi m\u1ee5c \u0111\u00edch h\u1ecdc t\u1eadp, t\u1ed1t nh\u1ea5t l\u00e0 c\u00e0i \u0111\u1eb7t TensorFlow trong m\u00f4i tr\u01b0\u1eddng \u1ea3o Python. TensorFlow \u0111\u01b0\u1ee3c coi l\u00e0 m\u1ed9t l\u1ef1a ch\u1ecdn t\u1ed1t cho nh\u1eefng ng\u01b0\u1eddi m\u1edbi l\u00e0m quen v\u1edbi m\u00e1y h\u1ecdc.<\/p>\n<p>H\u01b0\u1edbng d\u1eabn n\u00e0y m\u00f4 t\u1ea3 c\u00e1ch c\u00e0i \u0111\u1eb7t TensorFlow tr\u00ean Ubuntu 20.04, \u0111\u01b0\u1ee3c TensorFlow h\u1ed7 tr\u1ee3 \u0111\u1ea7y \u0111\u1ee7. Tuy nhi\u00ean, h\u1ea7u h\u1ebft c\u00e1c b\u1ea3n ph\u00e2n ph\u1ed1i Linux \u0111\u1ec1u tu\u00e2n theo quy tr\u00ecnh t\u01b0\u01a1ng t\u1ef1.<\/p>\n<h2 id=\"before-you-begin\">Tr\u01b0\u1edbc khi b\u1ea1n b\u1eaft \u0111\u1ea7u<a href=\"https:\/\/www.linode.com\/docs\/guides\/how-to-install-tensorflow\/#before-you-begin\"><\/a><\/h2>\n<ol>\n<li>N\u1ebfu b\u1ea1n ch\u01b0a th\u1ef1c hi\u1ec7n, h\u00e3y t\u1ea1o m\u1ed9t t\u00e0i kho\u1ea3n Linode v\u00e0 Compute Instance. Xem h\u01b0\u1edbng d\u1eabn&nbsp;<a href=\"https:\/\/www.linode.com\/docs\/products\/platform\/get-started\/\">B\u1eaft \u0111\u1ea7u v\u1edbi Linode<\/a>&nbsp;v\u00e0&nbsp;<a href=\"https:\/\/www.linode.com\/docs\/products\/compute\/compute-instances\/guides\/create\/\">T\u1ea1o Compute Instance<\/a>&nbsp;c\u1ee7a ch\u00fang t\u00f4i .<\/li>\n<li>L\u00e0m theo h\u01b0\u1edbng d\u1eabn&nbsp;<a href=\"https:\/\/www.linode.com\/docs\/products\/compute\/compute-instances\/guides\/set-up-and-secure\/\">Thi\u1ebft l\u1eadp v\u00e0 B\u1ea3o m\u1eadt Phi\u00ean b\u1ea3n Compute<\/a>&nbsp;c\u1ee7a ch\u00fang t\u00f4i \u0111\u1ec3 c\u1eadp nh\u1eadt h\u1ec7 th\u1ed1ng c\u1ee7a b\u1ea1n. B\u1ea1n c\u0169ng c\u00f3 th\u1ec3 mu\u1ed1n \u0111\u1eb7t m\u00fai gi\u1edd, c\u1ea5u h\u00ecnh t\u00ean m\u00e1y ch\u1ee7, t\u1ea1o t\u00e0i kho\u1ea3n ng\u01b0\u1eddi d\u00f9ng gi\u1edbi h\u1ea1n v\u00e0 t\u0103ng c\u01b0\u1eddng quy\u1ec1n truy c\u1eadp SSH.<\/li>\n<\/ol>\n<p class=\"has-background\" style=\"background-color:#74f78c33\">Ghi ch\u00fa: H\u01b0\u1edbng d\u1eabn n\u00e0y \u0111\u01b0\u1ee3c vi\u1ebft cho ng\u01b0\u1eddi d\u00f9ng kh\u00f4ng ph\u1ea3i root. C\u00e1c l\u1ec7nh y\u00eau c\u1ea7u quy\u1ec1n n\u00e2ng cao \u0111\u01b0\u1ee3c th\u00eam ti\u1ec1n t\u1ed1&nbsp;<code>sudo<\/code>. N\u1ebfu b\u1ea1n kh\u00f4ng quen v\u1edbi&nbsp;<code>sudo<\/code> l\u1ec7nh n\u00e0y, h\u00e3y xem h\u01b0\u1edbng d\u1eabn&nbsp;<a href=\"https:\/\/www.linode.com\/docs\/guides\/linux-users-and-groups\/\">Ng\u01b0\u1eddi d\u00f9ng v\u00e0 Nh\u00f3m Linux<\/a>&nbsp;.<\/p>\n<h2 id=\"advantages-of-tensorflow\">\u01afu \u0111i\u1ec3m c\u1ee7a TensorFlow<a href=\"https:\/\/www.linode.com\/docs\/guides\/how-to-install-tensorflow\/#advantages-of-tensorflow\"><\/a><\/h2>\n<ol>\n<li>TensorFlow cung c\u1ea5p nhi\u1ec1u m\u1ee9c \u0111\u1ed9 tr\u1eebu t\u01b0\u1ee3ng v\u00e0 ph\u1ee9c t\u1ea1p kh\u00e1c nhau cho nhi\u1ec1u lo\u1ea1i t\u00e1c v\u1ee5 kh\u00e1c nhau, c\u00f9ng v\u1edbi c\u00e1c API gi\u00fap b\u1ea1n d\u1ec5 d\u00e0ng b\u1eaft \u0111\u1ea7u h\u01a1n.<\/li>\n<li>N\u00f3 r\u1ea5t ph\u00f9 h\u1ee3p cho s\u1ea3n xu\u1ea5t c\u0169ng nh\u01b0 nghi\u00ean c\u1ee9u v\u00e0 th\u1eed nghi\u1ec7m.<\/li>\n<li>TensorFlow cung c\u1ea5p kh\u1ea3 n\u0103ng tr\u1ef1c quan h\u00f3a \u0111\u1ed3 th\u1ecb t\u00ednh to\u00e1n cao c\u1ea5p c\u00f9ng v\u1edbi c\u00e1c c\u00f4ng c\u1ee5 qu\u1ea3n l\u00fd th\u01b0 vi\u1ec7n v\u00e0 g\u1ee1 l\u1ed7i.<\/li>\n<li>N\u00f3 \u1ed5n \u0111\u1ecbnh, c\u00f3 kh\u1ea3 n\u0103ng m\u1edf r\u1ed9ng v\u00e0 cung c\u1ea5p hi\u1ec7u su\u1ea5t h\u00e0ng \u0111\u1ea7u v\u1edbi s\u1ef1 h\u1ed7 tr\u1ee3 tuy\u1ec7t v\u1eddi t\u1eeb c\u1ed9ng \u0111\u1ed3ng.<\/li>\n<\/ol>\n<h2 id=\"system-requirements\">Y\u00eau c\u1ea7u h\u1ec7 th\u1ed1ng<a href=\"https:\/\/www.linode.com\/docs\/guides\/how-to-install-tensorflow\/#system-requirements\"><\/a><\/h2>\n<ul>\n<li>M\u00f4i tr\u01b0\u1eddng l\u01b0u tr\u1eef m\u1ea1nh m\u1ebd v\u00e0 \u1ed5n \u0111\u1ecbnh v\u1edbi \u00edt nh\u1ea5t 4GB b\u1ed9 nh\u1edb, ch\u1eb3ng h\u1ea1n nh\u01b0 g\u00f3i&nbsp;<a href=\"https:\/\/www.linode.com\/products\/dedicated-cpu\/\" target=\"_blank\" rel=\"noreferrer noopener\"><em>Linode 4GB<\/em><\/a>&nbsp;.<\/li>\n<li>N\u1ebfu b\u1ea1n \u0111ang s\u1eed d\u1ee5ng Ubuntu, TensorFlow y\u00eau c\u1ea7u phi\u00ean b\u1ea3n 16.04 tr\u1edf l\u00ean.<\/li>\n<\/ul>\n<h2 id=\"prerequisites\">\u0110i\u1ec1u ki\u1ec7n ti\u00ean quy\u1ebft<a href=\"https:\/\/www.linode.com\/docs\/guides\/how-to-install-tensorflow\/#prerequisites\"><\/a><\/h2>\n<p>Tr\u01b0\u1edbc khi c\u00e0i \u0111\u1eb7t TensorFlow, b\u1ea1n c\u1ea7n c\u00e0i \u0111\u1eb7t nh\u1eefng ph\u1ea7n sau:<\/p>\n<ol>\n<li>Python 3.8 tr\u1edf l\u00ean v\u00e0 c\u00e1c th\u01b0 vi\u1ec7n c\u1ea7n thi\u1ebft<\/li>\n<li>M\u00f4i tr\u01b0\u1eddng \u1ea3o Python &#8211; \u0111\u1ec3 ch\u1ea1y TensorFlow b\u00ean trong m\u00f4i tr\u01b0\u1eddng \u1ea3o<\/li>\n<li>Phi\u00ean b\u1ea3n m\u1edbi nh\u1ea5t c\u1ee7a&nbsp;<code>pip<\/code>(phi\u00ean b\u1ea3n 19 tr\u1edf l\u00ean)<\/li>\n<\/ol>\n<p>Ph\u1ea7n sau \u0111\u00e2y gi\u1ea3i th\u00edch c\u00e1ch c\u00e0i \u0111\u1eb7t Python (n\u1ebfu b\u1ea1n ch\u01b0a c\u00e0i \u0111\u1eb7t), m\u00f4i tr\u01b0\u1eddng \u1ea3o Python v\u00e0 phi\u00ean b\u1ea3n m\u1edbi nh\u1ea5t c\u1ee7a&nbsp;<code>pip<\/code>.<\/p>\n<h3 id=\"check-python-and-its-required-libraries\">Ki\u1ec3m tra Python v\u00e0 c\u00e1c th\u01b0 vi\u1ec7n c\u1ea7n thi\u1ebft c\u1ee7a n\u00f3<a href=\"https:\/\/www.linode.com\/docs\/guides\/how-to-install-tensorflow\/#check-python-and-its-required-libraries\"><\/a><\/h3>\n<p>Ki\u1ec3m tra phi\u00ean b\u1ea3n Python hi\u1ec7n t\u1ea1i c\u1ee7a h\u1ec7 th\u1ed1ng b\u1ea1n.<\/p>\n<pre class=\"wp-block-code\"><code>python3 --version\n<\/code><\/pre>\n<pre class=\"wp-block-code\"><code>Python 3.8.5<\/code><\/pre>\n<p>C\u00e0i \u0111\u1eb7t pip n\u1ebfu n\u00f3 ch\u01b0a \u0111\u01b0\u1ee3c c\u00e0i \u0111\u1eb7t.<\/p>\n<pre class=\"wp-block-code\"><code>sudo apt install python3-pip\n<\/code><\/pre>\n<h3 id=\"install-python-virtual-environment\">C\u00e0i \u0111\u1eb7t Python Virtual Environment<a href=\"https:\/\/www.linode.com\/docs\/guides\/how-to-install-tensorflow\/#install-python-virtual-environment\"><\/a><\/h3>\n<p>1.N\u1ebfu b\u1ea1n \u0111\u00e3 c\u00e0i \u0111\u1eb7t Python, h\u00e3y n\u00e2ng c\u1ea5p&nbsp;<code>apt<\/code>v\u00e0 c\u00e0i \u0111\u1eb7t m\u00f4i tr\u01b0\u1eddng \u1ea3o Python c\u00f9ng c\u00e1c g\u00f3i c\u1ea7n thi\u1ebft.<\/p>\n<pre class=\"wp-block-code\"><code>sudo apt update\nsudo apt install python3-dev python3-pip python3-venv<\/code><\/pre>\n<p>2.X\u00e1c nh\u1eadn phi\u00ean b\u1ea3n c\u1ee7a c\u1ea3 Python v\u00e0&nbsp;<code>pip<\/code>.<\/p>\n<pre class=\"wp-block-code\"><code>python3 --version\npip3 --version\n<\/code><\/pre>\n<p>Ubuntu tr\u1ea3 v\u1ec1 phi\u00ean b\u1ea3n cho t\u1eebng m\u00f4-\u0111un.<\/p>\n<pre class=\"wp-block-code\"><code>Python 3.8.5\npip 20.0.2 from \/usr\/lib\/python3\/dist-packages\/pip (python 3.8)<\/code><\/pre>\n<ul>\n<li><\/li>\n<\/ul>\n<h3 id=\"create-python-virtual-environment\">T\u1ea1o m\u00f4i tr\u01b0\u1eddng \u1ea3o Python<a href=\"https:\/\/www.linode.com\/docs\/guides\/how-to-install-tensorflow\/#create-python-virtual-environment\"><\/a><\/h3>\n<p>Thi\u1ebft l\u1eadp m\u00f4i tr\u01b0\u1eddng Python \u1ea3o s\u1ebd t\u1ea1o ra m\u1ed9t m\u00f4i tr\u01b0\u1eddng bi\u1ec7t l\u1eadp cho c\u00e1c d\u1ef1 \u00e1n TensorFlow c\u1ee7a b\u1ea1n. Trong m\u00f4i tr\u01b0\u1eddng \u1ea3o n\u00e0y, b\u1ea1n c\u00f3 th\u1ec3 c\u00f3 m\u1ed9t b\u1ed9 g\u00f3i \u0111\u1ed9c l\u1eadp. \u0110i\u1ec1u n\u00e0y \u0111\u1ea3m b\u1ea3o c\u00e1c d\u1ef1 \u00e1n TensorFlow c\u1ee7a b\u1ea1n kh\u00f4ng th\u1ec3 \u1ea3nh h\u01b0\u1edfng x\u1ea5u \u0111\u1ebfn c\u00e1c d\u1ef1 \u00e1n Python kh\u00e1c c\u1ee7a b\u1ea1n.<\/p>\n<p>1.T\u1ea1o m\u1ed9t th\u01b0 m\u1ee5c m\u1edbi cho c\u00e1c d\u1ef1 \u00e1n ph\u00e1t tri\u1ec3n TensorFlow c\u1ee7a b\u1ea1n.<\/p>\n<pre class=\"wp-block-code\"><code> mkdir ~\/tensorflow-dev\n cd ~\/tensorflow-dev<\/code><\/pre>\n<p>2.T\u1ea1o m\u00f4i tr\u01b0\u1eddng \u1ea3o b\u1eb1ng l\u1ec7nh sau:<\/p>\n<pre class=\"wp-block-code\"><code> python3 -m venv --system-site-packages .\/venv\n<\/code><\/pre>\n<p>L\u1ec7nh tr\u00ean t\u1ea1o m\u1ed9t th\u01b0 m\u1ee5c c\u00f3 t\u00ean&nbsp;<code>venv<\/code>ch\u1ee9a c\u00e1c t\u1ec7p Python h\u1ed7 tr\u1ee3. B\u1ea1n c\u00f3 th\u1ec3 ch\u1ecdn b\u1ea5t k\u1ef3 t\u00ean n\u00e0o cho m\u00f4i tr\u01b0\u1eddng \u1ea3o thay cho&nbsp;<code>.\/venv<\/code>.<\/p>\n<p>3.K\u00edch ho\u1ea1t m\u00f4i tr\u01b0\u1eddng \u1ea3o c\u1ee7a b\u1ea1n b\u1eb1ng c\u00e1ch ch\u1ea1y&nbsp;<code>activate<\/code>t\u1eadp l\u1ec7nh.<\/p>\n<pre class=\"wp-block-code\"><code> source .\/venv\/bin\/activate<\/code><\/pre>\n<p class=\"has-background\" style=\"background-color:#74f78c33\">Ghi ch\u00fa: <code>source<\/code>L\u1ec7nh&nbsp;n\u00e0y ho\u1ea1t \u0111\u1ed9ng v\u1edbi shell&nbsp;<code>sh<\/code>,&nbsp;<code>bash<\/code>, v\u00e0&nbsp;<code>zsh<\/code>. N\u1ebfu b\u1ea1n \u0111ang s\u1eed d\u1ee5ng shell a&nbsp;<code>csh<\/code> ho\u1eb7c&nbsp;<code>tcsh<\/code>shell, h\u00e3y k\u00edch ho\u1ea1t m\u00f4i tr\u01b0\u1eddng \u1ea3o b\u1eb1ng&nbsp;<code>source .\/venv\/bin\/activate.csh<\/code>. B\u1ea1n c\u00f3 th\u1ec3 x\u00e1c \u0111\u1ecbnh t\u00ean c\u1ee7a shell b\u1ea1n \u0111ang ch\u1ea1y b\u1eb1ng l\u1ec7nh&nbsp;<code>echo $0<\/code>.<\/p>\n<p>4.Sau khi k\u00edch ho\u1ea1t m\u00f4i tr\u01b0\u1eddng \u1ea3o, d\u1ea5u nh\u1eafc shell c\u1ee7a b\u1ea1n s\u1ebd \u0111\u01b0\u1ee3c m\u1edf \u0111\u1ea7u b\u1eb1ng&nbsp;<code>(venv)<\/code>(ho\u1eb7c b\u1ea5t k\u1ef3 t\u00ean n\u00e0o b\u1ea1n \u0111\u00e3 ch\u1ecdn cho th\u01b0 m\u1ee5c m\u00f4i tr\u01b0\u1eddng \u1ea3o).<\/p>\n<pre class=\"wp-block-code\"><code>(venv) example-user@example-hostname:~\/tensorflow-dev$\n<\/code><\/pre>\n<p>5.C\u00e0i \u0111\u1eb7t TensorFlow y\u00eau c\u1ea7u&nbsp;<code>pip<\/code>phi\u00ean b\u1ea3n 19 tr\u1edf l\u00ean. V\u00ec v\u1eady, trong m\u00f4i tr\u01b0\u1eddng \u1ea3o, h\u00e3y n\u00e2ng c\u1ea5p&nbsp;<code>pip<\/code>g\u00f3i b\u1eb1ng l\u1ec7nh sau:<\/p>\n<pre class=\"wp-block-code\"><code> pip install --upgrade pip\n<\/code><\/pre>\n<p>\u0110\u1ea7u ra c\u1ee7a b\u1ea1n x\u00e1c nh\u1eadn vi\u1ec7c&nbsp;<code>pip<\/code>n\u00e2ng c\u1ea5p.<\/p>\n<pre class=\"wp-block-code\"><code>Successfully installed pip-21.0.1\n<\/code><\/pre>\n<p class=\"has-background\" style=\"background-color:#74f78c33\">Ghi ch\u00fa: B\u1ea1n c\u00f3 th\u1ec3 tho\u00e1t kh\u1ecfi m\u00f4i tr\u01b0\u1eddng \u1ea3o b\u1ea5t k\u1ef3 l\u00fac n\u00e0o b\u1eb1ng l\u1ec7nh&nbsp;<code>deactivate<\/code>. B\u1ea1n c\u00f3 th\u1ec3 s\u1eed d\u1ee5ng&nbsp;<code>source<\/code>l\u1ec7nh \u0111\u1ec3 k\u00edch ho\u1ea1t l\u1ea1i sau. Ch\u00fang t\u00f4i khuy\u00ean b\u1ea1n n\u00ean \u1edf l\u1ea1i b\u00ean trong m\u00f4i tr\u01b0\u1eddng \u1ea3o trong khi s\u1eed d\u1ee5ng TensorFlow.<\/p>\n<h2 id=\"install-tensorflow\">C\u00e0i \u0111\u1eb7t TensorFlow<a href=\"https:\/\/www.linode.com\/docs\/guides\/how-to-install-tensorflow\/#install-tensorflow\"><\/a><\/h2>\n<p>1.Trong m\u00f4i tr\u01b0\u1eddng \u1ea3o, h\u00e3y c\u00e0i \u0111\u1eb7t TensorFlow b\u1eb1ng c\u00e1ch s\u1eed d\u1ee5ng&nbsp;<code>pip<\/code>. L\u1ec7nh sau s\u1ebd t\u1ea3i phi\u00ean b\u1ea3n \u1ed5n \u0111\u1ecbnh m\u1edbi nh\u1ea5t c\u00f9ng v\u1edbi t\u1ea5t c\u1ea3 c\u00e1c g\u00f3i ph\u1ee5 thu\u1ed9c.<\/p>\n<pre class=\"wp-block-code\"><code> pip install --upgrade tensorflow\n<\/code><\/pre>\n<p>2.Li\u1ec7t k\u00ea c\u00e1c g\u00f3i Python b\u1eb1ng l\u1ec7nh sau v\u00e0 x\u00e1c nh\u1eadn&nbsp;<code>tensorflow<\/code>s\u1ef1 hi\u1ec7n di\u1ec7n.<\/p>\n<pre class=\"wp-block-code\"><code> pip list | grep tensorflow\n<\/code><\/pre>\n<p>M\u00f4&nbsp;<code>tensorflow<\/code>-\u0111un c\u1ea7n \u0111\u01b0\u1ee3c li\u1ec7t k\u00ea.<\/p>\n<pre class=\"wp-block-code\"><code>tensorflow             2.4.1\n<\/code><\/pre>\n<p>Ghi ch\u00fa:<\/p>\n<p>B\u1ea1n c\u00f3 th\u1ec3 l\u00e0m theo c\u00e1c b\u01b0\u1edbc d\u01b0\u1edbi \u0111\u00e2y \u0111\u1ec3 c\u00e0i \u0111\u1eb7t TensorFlow m\u00e0 kh\u00f4ng c\u1ea7n s\u1eed d\u1ee5ng m\u00f4i tr\u01b0\u1eddng \u1ea3o, nh\u01b0ng KH\u00d4NG&nbsp;<strong>khuy\u1ebfn<\/strong>&nbsp;kh\u00edch.<\/p>\n<ul>\n<li>N\u00e2ng c\u1ea5p m\u00f4-\u0111un d\u00e0nh ri\u00eang cho Python&nbsp;<code>pip<\/code>v\u1edbi<code>python -m pip install --upgrade pip<\/code><\/li>\n<li>C\u00e0i \u0111\u1eb7t TensorFlow b\u1eb1ng c\u00e1ch s\u1eed d\u1ee5ng&nbsp;<code>pip3 install --user --upgrade tensorflow<\/code>.<\/li>\n<\/ul>\n<p>H\u00e3y h\u1ebft s\u1ee9c c\u1ea9n th\u1eadn khi n\u00e2ng c\u1ea5p phi\u00ean b\u1ea3n pip c\u1ee7a h\u1ec7 th\u1ed1ng v\u00ec \u0111i\u1ec1u n\u00e0y c\u00f3 th\u1ec3 g\u00e2y ra nh\u1eefng t\u00e1c d\u1ee5ng ph\u1ee5 kh\u00f4ng mong mu\u1ed1n.<\/p>\n<h2 id=\"test-your-tensorflow-installation\">Ki\u1ec3m tra c\u00e0i \u0111\u1eb7t TensorFlow c\u1ee7a b\u1ea1n<a href=\"https:\/\/www.linode.com\/docs\/guides\/how-to-install-tensorflow\/#test-your-tensorflow-installation\"><\/a><\/h2>\n<p>1.N\u1ebfu b\u1ea1n \u0111\u00e3 l\u00e0m theo t\u1ea5t c\u1ea3 c\u00e1c b\u01b0\u1edbc tr\u00ean v\u00e0 c\u00e0i \u0111\u1eb7t TensorFlow, vi\u1ec7c x\u00e1c minh c\u00e0i \u0111\u1eb7t TensorFlow kh\u00e1 d\u1ec5 d\u00e0ng. S\u1eed d\u1ee5ng l\u1ec7nh sau \u0111\u1ec3 in phi\u00ean b\u1ea3n TensorFlow:<\/p>\n<pre class=\"wp-block-code\"><code> python -c 'import tensorflow as tf; print(tf.__version__)'\n<\/code><\/pre>\n<pre class=\"wp-block-code\"><code>2021-04-30 10:34:32.450931: W tensorflow\/stream_executor\/platform\/default\/dso_loader.cc:60] Could not load dynamic library 'libcudart.so.11.0'; dlerror: libcudart.so.11.0: cannot open shared object file: No such file or directory\n2021-04-30 10:34:32.450973: I tensorflow\/stream_executor\/cuda\/cudart_stub.cc:29] Ignore above cudart dlerror if you do not have a GPU set up on your machine.\n2.4.1<\/code><\/pre>\n<p class=\"has-background\" style=\"background-color:#74f78c33\">Ghi ch\u00fa: N\u1ebfu Linode c\u1ee7a b\u1ea1n kh\u00f4ng ch\u1ea1y GPU, b\u1ea1n c\u00f3 th\u1ec3 nh\u1eadn \u0111\u01b0\u1ee3c c\u1ea3nh b\u00e1o&nbsp;<code>Libcudart<\/code>ho\u1eb7c th\u01b0 vi\u1ec7n GPU t\u01b0\u01a1ng t\u1ef1 kh\u00f4ng th\u1ec3 t\u1ea3i \u0111\u01b0\u1ee3c. Th\u00f4ng b\u00e1o n\u00e0y \u0111\u01b0\u1ee3c mong \u0111\u1ee3i khi ch\u1ea1y Linode ch\u1ea1y b\u1eb1ng CPU. Trong tr\u01b0\u1eddng h\u1ee3p n\u00e0y, b\u1ea1n s\u1ebd th\u1ea5y th\u00f4ng&nbsp;<code>info<\/code> b\u00e1o khuy\u00ean b\u1ea1n b\u1ecf qua th\u00f4ng b\u00e1o trong m\u00f4i tr\u01b0\u1eddng kh\u00f4ng ph\u1ea3i GPU.<\/p>\n<p>2.\u0110\u1ec3 v\u00f4 hi\u1ec7u h\u00f3a c\u1ea3nh b\u00e1o ho\u1eb7c th\u00f4ng b\u00e1o l\u1ed7i, b\u1ea1n c\u00f3 th\u1ec3 s\u1eed d\u1ee5ng&nbsp;<code>os.environ<\/code>bi\u1ebfn \u0111\u1ec3 gi\u1ea3m m\u1ee9c c\u1ea3nh b\u00e1o nh\u1eadt k\u00fd m\u00e0 b\u1ea1n nh\u1eadn \u0111\u01b0\u1ee3c. V\u00ed d\u1ee5 b\u00ean d\u01b0\u1edbi in phi\u00ean b\u1ea3n TensorFlow m\u00e0 kh\u00f4ng c\u00f3 b\u1ea5t k\u1ef3 c\u1ea3nh b\u00e1o n\u00e0o.<\/p>\n<pre class=\"wp-block-code\"><code> python -c 'import os; os.environ&#91;\"TF_CPP_MIN_LOG_LEVEL\"]=\"3\"; import tensorflow as tf; print(tf.__version__)'\n<\/code><\/pre>\n<pre class=\"wp-block-code\"><code>2.4.1<\/code><\/pre>\n<p class=\"has-background\" style=\"background-color:#74f78c33\">Ghi ch\u00fa<\/p>\n<p class=\"has-background\" style=\"background-color:#74f78c33\">B\u1ea1n c\u00f3 th\u1ec3 s\u1eed d\u1ee5ng c\u00e1c m\u1ee9c nh\u1eadt k\u00fd kh\u00e1c nhau thay cho &#8216;3&#8217; nh\u01b0 \u0111\u01b0\u1ee3c hi\u1ec3n th\u1ecb b\u00ean d\u01b0\u1edbi:<\/p>\n<p class=\"has-background\" style=\"background-color:#74f78c33\"><code>0<\/code>= t\u1ea5t c\u1ea3 c\u00e1c tin nh\u1eafn \u0111\u01b0\u1ee3c ghi l\u1ea1i (h\u00e0nh vi m\u1eb7c \u0111\u1ecbnh)<\/p>\n<p class=\"has-background\" style=\"background-color:#74f78c33\"><code>1<\/code>= Tin nh\u1eafn INFO kh\u00f4ng \u0111\u01b0\u1ee3c in<\/p>\n<p class=\"has-background\" style=\"background-color:#74f78c33\"><code>2<\/code>= Tin nh\u1eafn INFO v\u00e0 WARNING kh\u00f4ng \u0111\u01b0\u1ee3c in<\/p>\n<p class=\"has-background\" style=\"background-color:#74f78c33\"><code>3<\/code>= C\u00e1c th\u00f4ng b\u00e1o INFO, WARNING v\u00e0 ERROR kh\u00f4ng \u0111\u01b0\u1ee3c in<\/p>\n<p>3.\u0110\u1ec3 h\u1ee7y k\u00edch ho\u1ea1t m\u00f4i tr\u01b0\u1eddng \u1ea3o v\u00e0 chuy\u1ec3n v\u1ec1 shell kh\u00f4ng \u1ea3o ban \u0111\u1ea7u, h\u00e3y ch\u1ea1y l\u1ec7nh sau:<\/p>\n<pre class=\"wp-block-code\"><code>deactivate<\/code><\/pre>\n<p class=\"has-background\" style=\"background-color:#74f78c33\">Ghi ch\u00fa: B\u1ea1n lu\u00f4n c\u00f3 th\u1ec3 ch\u1ea1y&nbsp;<code>source .\/venv\/bin\/activate<\/code>\u0111\u1ec3 v\u00e0o l\u1ea1i m\u00f4i tr\u01b0\u1eddng \u1ea3o.<\/p>\n<h2 id=\"for-further-reference\">\u0110\u1ec3 tham kh\u1ea3o th\u00eam<a href=\"https:\/\/www.linode.com\/docs\/guides\/how-to-install-tensorflow\/#for-further-reference\"><\/a><\/h2>\n<p>H\u1ecdc m\u00e1y l\u00e0 m\u1ed9t l\u0129nh v\u1ef1c ph\u1ee9c t\u1ea1p v\u00e0 TensorFlow l\u00e0 m\u1ed9t \u1ee9ng d\u1ee5ng l\u1edbn v\u00e0 ph\u1ee9c t\u1ea1p. \u0110\u1ec3 gi\u00fap b\u1ea1n b\u1eaft \u0111\u1ea7u, TensorFlow cung c\u1ea5p m\u1ed9t s\u1ed1 t\u00e0i nguy\u00ean b\u1ed5 sung:<\/p>\n<ul>\n<li><a href=\"https:\/\/www.tensorflow.org\/tutorials\" target=\"_blank\" rel=\"noreferrer noopener\">H\u01b0\u1edbng d\u1eabn TensorFlow d\u00e0nh cho ng\u01b0\u1eddi m\u1edbi b\u1eaft \u0111\u1ea7u v\u00e0 chuy\u00ean gia<\/a><\/li>\n<li><a href=\"https:\/\/www.tensorflow.org\/guide\" target=\"_blank\" rel=\"noreferrer noopener\">T\u00e0i li\u1ec7u TensorFlow thi\u1ebft y\u1ebfu<\/a><\/li>\n<li>Danh s\u00e1ch&nbsp;<a href=\"https:\/\/www.tensorflow.org\/api_docs\/python\/tf\" target=\"_blank\" rel=\"noreferrer noopener\">c\u00e1c m\u00f4-\u0111un v\u00e0 ch\u1ee9c n\u0103ng c\u1ee7a TensorFlow<\/a><\/li>\n<li>Gi\u1edbi thi\u1ec7u v\u1ec1&nbsp;<a href=\"https:\/\/www.tensorflow.org\/resources\/learn-ml\" target=\"_blank\" rel=\"noreferrer noopener\">m\u00e1y h\u1ecdc<\/a><\/li>\n<li><a href=\"https:\/\/www.tensorflow.org\/resources\/tools\" target=\"_blank\" rel=\"noreferrer noopener\">C\u00e1c c\u00f4ng c\u1ee5<\/a>&nbsp;h\u1ed7 tr\u1ee3 quy tr\u00ecnh l\u00e0m vi\u1ec7c TensorFlow c\u1ee7a b\u1ea1n<\/li>\n<li><a href=\"https:\/\/www.tensorflow.org\/community\" target=\"_blank\" rel=\"noreferrer noopener\">C\u1ed9ng \u0111\u1ed3ng TensorFlow<\/a>&nbsp;g\u1ee3i \u00fd cho b\u1ea1n c\u00e1ch tham gia v\u00e0 \u0111\u00f3ng g\u00f3p.<\/li>\n<\/ul>\n<p>Ch\u00fang t\u00f4i khuy\u00ean b\u1ea1n n\u00ean t\u00ecm hi\u1ec3u k\u1ef9&nbsp;<a href=\"https:\/\/www.tensorflow.org\/\" target=\"_blank\" rel=\"noreferrer noopener\">trang web TensorFlow<\/a>&nbsp;khi th\u1ef1c hi\u1ec7n c\u00e1c d\u1ef1 \u00e1n c\u1ee7a m\u00ecnh.<\/p>\n<h2 id=\"more-information\">Th\u00f4ng tin th\u00eam<\/h2>\n<p>B\u1ea1n c\u00f3 th\u1ec3 mu\u1ed1n tham kh\u1ea3o c\u00e1c ngu\u1ed3n sau \u0111\u1ec3 bi\u1ebft th\u00eam th\u00f4ng tin v\u1ec1 ch\u1ee7 \u0111\u1ec1 n\u00e0y. M\u1eb7c d\u00f9 ch\u00fang t\u00f4i cung c\u1ea5p v\u1edbi hy v\u1ecdng r\u1eb1ng ch\u00fang s\u1ebd h\u1eefu \u00edch, nh\u01b0ng xin l\u01b0u \u00fd r\u1eb1ng ch\u00fang t\u00f4i kh\u00f4ng th\u1ec3 \u0111\u1ea3m b\u1ea3o t\u00ednh ch\u00ednh x\u00e1c ho\u1eb7c t\u00ednh k\u1ecbp th\u1eddi c\u1ee7a c\u00e1c t\u00e0i li\u1ec7u \u0111\u01b0\u1ee3c l\u01b0u tr\u1eef b\u00ean ngo\u00e0i.<\/p>\n<ul>\n<li><a href=\"https:\/\/www.tensorflow.org\/\" target=\"_blank\" rel=\"noreferrer noopener\">Trang web TensorFlow<\/a><\/li>\n<li><a href=\"https:\/\/en.wikipedia.org\/wiki\/Deep_learning\" target=\"_blank\" rel=\"noreferrer noopener\">m\u1ea1ng l\u01b0\u1edbi n\u01a1-ron s\u00e2u<\/a><\/li>\n<li><a href=\"https:\/\/www.tensorflow.org\/tutorials\" target=\"_blank\" rel=\"noreferrer noopener\">H\u01b0\u1edbng d\u1eabn TensorFlow d\u00e0nh cho ng\u01b0\u1eddi m\u1edbi b\u1eaft \u0111\u1ea7u v\u00e0 chuy\u00ean gia<\/a><\/li>\n<li><a href=\"https:\/\/www.tensorflow.org\/guide\" target=\"_blank\" rel=\"noreferrer noopener\">T\u00e0i li\u1ec7u TensorFlow thi\u1ebft y\u1ebfu<\/a><\/li>\n<li><a href=\"https:\/\/www.tensorflow.org\/api_docs\/python\/tf\" target=\"_blank\" rel=\"noreferrer noopener\">C\u00e1c m\u00f4-\u0111un v\u00e0 ch\u1ee9c n\u0103ng c\u1ee7a TensorFlow<\/a><\/li>\n<li><a href=\"https:\/\/www.tensorflow.org\/resources\/learn-ml\" target=\"_blank\" rel=\"noreferrer noopener\">h\u1ecdc m\u00e1y<\/a><\/li>\n<li><a href=\"https:\/\/www.tensorflow.org\/resources\/tools\" target=\"_blank\" rel=\"noreferrer noopener\">C\u00f4ng c\u1ee5<\/a><\/li>\n<li><a href=\"https:\/\/www.tensorflow.org\/community\" target=\"_blank\" rel=\"noreferrer noopener\">C\u1ed9ng \u0111\u1ed3ng TensorFlow<\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>TensorFlow&nbsp;l\u00e0 m\u1ed9t th\u01b0 vi\u1ec7n ph\u1ea7n m\u1ec1m ngu\u1ed3n m\u1edf \u0111\u01b0\u1ee3c s\u1eed d\u1ee5ng cho m\u00e1y h\u1ecdc v\u00e0 \u0111\u1ec3 \u0111\u00e0o t\u1ea1o&nbsp;m\u1ea1ng n\u01a1-ron s\u00e2u&nbsp;. Google \u0111\u00e3 ph\u00e1t tri\u1ec3n TensorFlow cho c\u1ea3 m\u1ee5c \u0111\u00edch nghi\u00ean c\u1ee9u v\u00e0 s\u1ea3n xu\u1ea5t, nh\u01b0ng hi\u1ec7n t\u1ea1i n\u00f3 \u0111\u01b0\u1ee3c ph\u00e1t h\u00e0nh theo gi\u1ea5y ph\u00e9p Apache. N\u00f3 c\u00f3 s\u1eb5n cho nhi\u1ec1u h\u1ec7 \u0111i\u1ec1u h\u00e0nh, bao g\u1ed3m<\/p>\n","protected":false},"author":1,"featured_media":35509,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[101],"tags":[],"class_list":["post-34877","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-big-data"],"_links":{"self":[{"href":"https:\/\/jupitek.maudemo.vip\/index.php\/wp-json\/wp\/v2\/posts\/34877","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/jupitek.maudemo.vip\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/jupitek.maudemo.vip\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/jupitek.maudemo.vip\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/jupitek.maudemo.vip\/index.php\/wp-json\/wp\/v2\/comments?post=34877"}],"version-history":[{"count":0,"href":"https:\/\/jupitek.maudemo.vip\/index.php\/wp-json\/wp\/v2\/posts\/34877\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/jupitek.maudemo.vip\/index.php\/wp-json\/wp\/v2\/media\/35509"}],"wp:attachment":[{"href":"https:\/\/jupitek.maudemo.vip\/index.php\/wp-json\/wp\/v2\/media?parent=34877"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/jupitek.maudemo.vip\/index.php\/wp-json\/wp\/v2\/categories?post=34877"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/jupitek.maudemo.vip\/index.php\/wp-json\/wp\/v2\/tags?post=34877"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}