In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)05/31 Report--
This article introduces the knowledge of "how to build an environment based on ubuntu16 Python3 tensorflow". In the operation of practical cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!
First, install virtual machine vmware workstation under windows and install ubuntu in virtual machine (to make good use of search engine and solve all kinds of simple problems)
Installation completed:
Second, install python3 in ubuntu
Enter the system, right-click the desktop, and click open terminal
Enter command line mode. Enter python and find that the system comes with python2.7. We are going to install python3
Exit python (with exit ()), type sudo apt-get install python3, and install python3. Has been installed in advance, the installation is python3.5 below is the content shown, the installation is successful.
Third, install tensorflow
There are many installation methods, you can search on your own. Tensorflow has two versions, cpu and gpu, the latter supports the use of gpu capabilities for data operations, has certain restrictions on the model of gpu, and has to install a bunch of things, which is not necessary for beginners (cpu is officially recommended).
Install pip and virtualenv with the following command
Sudo apt-get install python-pip python-dev python-virtualenvsudo apt-get install python3-pip python3-dev python3-virtualenv
Create a virtualenv environment
Virtualenv-system-site-packages targetdirectory
Note: the "targetdirectory" here defines the root directory of virtualenv, and ~ / tensorflow is recommended here, so the input here is:
Virtualenv-- system-site-packages ~ / tensorflow
Activate the virtualenv environment you just created
In general (if you are using a terminal that comes with ubuntu or you are not using csh) enter: source ~ / tensorflow/bin/activate12
If the terminal you use is csh, please enter: source ~ / tensorflow/bin/activate.csh12
After entering the command, (tensorflow) appears in front of your command line, if successful.
4. Now, in this activated tensorflow environment, install the cpu version of tensorflow using the following statement
(tensorflow) $pip install-- upgrade tensorflow # if you use python 2.7( tensorflow) $pip3 install-- upgrade tensorflow # if you use python3.n
Installation successful!
5. Testing:
1. Open the terminal and enter cd tensorflow
2 、 source bin/activate
3 、 python
4. Enter the following example after entering python
> import tensorflow as tf > hello = tf.constant ('hello, tensorflowsheet') > sess = tf.session () > print (sess.run (hello)) hello, tensorflow! > > a = tf.constant (10) > b = tf.constant (32) > print (sess.run (aquib)) 42 >
5. If the test is successful, first exit python and press ctrl+d.
6. Exit tensorflow and enter the command on the command line: deactivate
This is the end of the content of "how to build an environment based on ubuntu16 Python3 tensorflow". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!
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.