简体   繁体   中英

How do I launch Tensorboard?

I am following the introductory guide on Tensorflow at https://www.tensorflow.org/guide/low_level_intro , and managed to create an 'events.out' file by using

writer = tf.summary.FileWriter('.')
writer.add_graph(tf.get_default_graph())
writer.flush() 

in my python file and running it. The next step is to launch Tensorboard in a 'terminal' with the 'shell command' tensorboard --logdir . How to do this? What terminal am I supposed to use? I tried windows powershell but it does not seem to work. It gives the error

tensorboard : The term 'tensorboard' is not recognized as the name of a cmdlet, function, script file, or operable prog ram. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. At line:1 char:1 + tensorboard --logdir + ~~~~~~~~~~~ + CategoryInfo : ObjectNotFound: (tensorboard:String) [], CommandNotFoundException + FullyQualifiedErrorId : CommandNotFoundException

Using PowerShell is fine. It sounds like your PATH is not configured to find the Tensorboard binary like others are saying. Can you show me what you get for pip show tensorflow ? It should have something like below:

(1) ➜  ~ pip show tensorflow
DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7.
Name: tensorflow
Version: 1.12.0
Summary: TensorFlow is an open source machine learning framework for everyone.
Home-page: https://www.tensorflow.org/
Author: Google Inc.
Author-email: opensource@google.com
License: Apache 2.0
Location: c:\users\stephanwlee\venv\tf\lib\site-packages
Requires: enum34, keras-preprocessing, wheel, astor, backports.weakref, mock, tensorboard, termcolor, protobuf, gast, absl-py, grpcio, six, keras-applications, numpy
Required-by:

In above output, location is the important piece that tells you where binaries are roughly gets placed. If you are using virtualenv like the TensorFlow installation guide (everything should be set up seamlessly and I would recommend you to use it), the binaries should be in c:\\users\\stephanwlee\\venv\\tf\\Scripts . Please check and see if the path is in $env:path .

If any of these didn't help, please do add result of pip show tensorflow and $env:path from PowerShell in the response, thanks!

pip show tensorflow
Name: tensorflow
Version: 2.7.0
Summary: TensorFlow is an open source machine learning framework for everyone.
Home-page: https://www.tensorflow.org/
Author: Google Inc.
Author-email: packages@tensorflow.org
License: Apache 2.0
Location: c:\users\luis\appdata\local\packages\pythonsoftwarefoundation.python.3.9_qbz5n2kfra8p0\localcache\local-packages\python39\site-packages
Requires: absl-py, astunparse, flatbuffers, gast, google-pasta, grpcio, h5py, keras, keras-preprocessing, libclang, numpy, opt-einsum, protobuf, six, tensorboard, tensorflow-estimator, tensorflow-io-gcs-filesystem, termcolor, typing-extensions, wheel, wrapt
Required-by:
   LUIS@XEONE5-2620-v2  ~ 
❯
   LUIS@XEONE5-2620-v2  ~ 
❯ $env:path
C:\Program Files\Microsoft MPI\Bin\;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\Program Files\Git\cmd;C:\mingw64\bin;C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\170\Tools\Binn\;C:\Program Files (x86)\Microsoft SQL Server\150\Tools\Binn\;C:\Program Files\Microsoft SQL Server\150\Tools\Binn\;C:\Program Files\Microsoft SQL Server\150\DTS\Binn\;C:\Program Files\Azure Data Studio\bin;C:\Strawberry\c\bin;C:\Strawberry\perl\site\bin;C:\Strawberry\perl\bin;C:\Program Files\MiKTeX\miktex\bin\x64\;C:\Program Files (x86)\Cracklock\Bin;C:\Users\LUIS\AppData\Local\Microsoft\WindowsApps;C:\Program Files\Azure Data Studio\bin;;C:\Users\LUIS\AppData\Local\Programs\oh-my-posh\bin;C:\Users\LUIS\AppData\Local\Programs\oh-my-posh\themes;D:\Program Files\Microsoft VS Code\bin

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM