In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly explains "how to install tensorflow under mac". The content in the article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn how to install tensorflow under mac.
Installation: 1. Install virtualenv use the pip command to install vmac$ sudo pip install-- upgrade virtualenv 2. After installation, I created a working directory, and I created a folder directly in home. Vmac$ virtualenv-- system-site-packages ~ / tensorflow 3. Then enter the directory to activate the sandbox vmac$ cd ~ / tensorflow vmac$ source bin/activate (tensorflow) vmac$ 4. Download tensorflow http://pan.baidu.com/s/1ntjaMnf password: sznb puts the downloaded tensorflow-0.5.0-py2-none-any.whl file in the ~ / tensorflow directory. After entering the sandbox, execute the command to install tensorflow in the sandbox. (tensorflow) vmac$ pip install-- upgrade tensorflow-0.5.0-py2-none-any.whl
5. Create a myfirst.py file to test it. Vmac$ python myfirst.pyimport tensorflow as tfimport numpy as np# Create 100 phony x, y data points in NumPy, y = x * 0.1 + 0.3x_data = np.random.rand (100) .astype (np.float32) y_data = x_data * 0.1 + 0.1 Try to find values for W and b that compute y_data = W * x_data + b # (We know that W should be 0.1 and b 0.3 But Tensorflow will# figure that out for us.) W = tf.Variable (tf.random_uniform ([1],-1.0,1.0)) b = tf.Variable (tf.zeros ([1])) y = W * x_data + b # Minimize the mean squared errors.loss = tf.reduce_mean (tf.square (y-y_data)) optimizer = tf.train.GradientDescentOptimizer (0.5) train = optimizer.minimize (loss) # Before starting, initialize the variables. We will 'run' this first.init = tf.initialize_all_variables () # Launch the graph.sess = tf.Session () sess.run (init) # Fit the line.for step in range: sess.run (train) if step% 20 = 0: print (step, sess.run (W), sess.run (b)) # Learns best fit is W: [0.1], b: [0.3] Thank you for reading The above is the content of "how to install tensorflow under mac". After the study of this article, I believe you have a deeper understanding of how to install tensorflow under mac, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!
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.