In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
Today, I will talk to you about how to install the tensorflow environment in Docke. Many people may not know much about it. In order to make you understand better, the editor has summarized the following content for you. I hope you can get something according to this article.
First, download the TensorFlow image
Docker pull tensorflow/tensorflow
Create a TensorFlow container
Docker run-- name corwien-tensortflow-it-p 8888 purl 8888-v / Users/kaiyiwang/Code/ai/notebooks:/notebooks/data tensorflow/tensorflow
Command description
Docker run runs the image
-- name creates aliases for containers
-it keeps the command line running
-p 8888Suzhou 8888 maps the local port 8888 http://localhost:8888/
-v / Users/kaiyiwang/Code/ai/notebooks:/notebooks/data Mount the local / Users/kaiyiwang/Code/ai/notebooks folder to the / notebooks/data of the new container (the files created in this way can be saved to the local / Users/kaiyiwang/Code/ai/notebooks)
Tensorflow/tensorflow is the specified image, and the default label is latest (i.e. tensorflow/tensorflow:latest)
Execute the above command:
We can see that the TensorFlow container is created and a page that logs in to JupiterNotebook by default is given.
We can see the executing container and the corresponding mapping port in the new command window with the following command
Docker ps
3. Open the TensorFlow container
1. You can right-click to open the connection directly from the command line, or type http://127.0.0.1:8888 in the browser and paste the token on the command line.
Start TensorFlow programming
1. Click to log in to see the interface and new a project.
2. Interpretation of tensorflow sample source code
From _ _ future__ import print_function# imports tensorflowimport tensorflow as tf#, inputs two arrays, input1 and input2, and then adds the output with tf.Session (): input1 = tf.constant ([1.0,1.0,1.0,1.0]) input2 = tf.constant ([2.0,2.0,2.0,2.0]) output = tf.add (input1, input2) result = output.eval () print ("result:", result)
3. Run the program, and the output result is (run successfully)
Result: [3. 3. 3. 3.]
V. relevant orders
1. Turn off or enable the TensorFlow environment
# close tensorflow Container docker stop corwien-tensortflow# Open TensorFlow Container docker start corwien-tensortflow# browser enter http://localhost:8888/
2. Modify the read and write permissions of the file
# View read and write permissions ls-l# change tensorflow to belong to corwien (system default) user sudo chown-R corwien tensorflow/# change tensorflow to belong to corwien (system default) user group sudo chgrp-R corwien tensorflow/ after reading the above, do you have any further understanding of how to install tensorflow environment in Docke? If you want to know more knowledge or related content, please follow the industry information channel, thank you for your support.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.