报错信息:
(pytorch) PS D:\Code\Python\torch_test> tensorboard --logdir=logs
tensorboard : 无法将“tensorboard”项识别为 cmdlet、函数、脚本文件或可运行程序的名称。请检查名称的拼写,如果包括路径,请确保路径正确,然后再试
一次。
所在位置 行:1 字符: 1
+ tensorboard --logdir=logs
+ ~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (tensorboard:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
解决方案
1、卸载tensorboard
先卸载当前版本的tensorboard,出现成功卸载的提示。
(pytorch) PS D:\Code\Python\torch_test> pip uninstall tensorboard
Found existing installation: tensorboard 2.10.0
Uninstalling tensorboard-2.10.0:
Would remove:
d:\anaconda\envs\pytorch\lib\site-packages\tensorboard-2.10.0.dist-info\*
d:\anaconda\envs\pytorch\lib\site-packages\tensorboard\*
Proceed (Y/n)? n(pytorch) PS D:\Code\Python\torch_test> pip uninstall tensorboard
Found existing installation: tensorboard 2.10.0
Uninstalling tensorboard-2.10.0:
Would remove:
d:\anaconda\envs\pytorch\lib\site-packages\tensorboard-2.10.0.dist-info\*
d:\anaconda\envs\pytorch\lib\site-packages\tensorboard\*
Proceed (Y/n)? y
Successfully uninstalled tensorboard-2.10.0
2、重新使用pip安装
(pytorch) PS D:\Code\Python\torch_test> pip install tensorboard
Collecting tensorboard
Obtaining dependency information for tensorboard from https://files.pythonhosted.org/packages/bc/a2/ff5f4c299eb37c95299a76015da3f30211468e29d8d6f1d011683279baee/tensorboard-2.14.0-py3-none-any.whl.metadata
Using cached tensorboard-2.14.0-py3-none-any.whl.metadata (1.8 kB)
Requirement already satisfied: absl-py>=0.4 in d:\anaconda\envs\pytorch\lib\site-packages (from tensorboard) (1.4.0)
Requirement already satisfied: grpcio>=1.48.2 in d:\anaconda\envs\pytorch\lib\site-packages (from tensorboard) (1.48.2)
Requirement already satisfied: google-auth<3,>=1.6.3 in d:\anaconda\envs\pytorch\lib\site-packages (from tensorboard) (2.6.0)
Collecting google-auth-oauthlib<1.1,>=0.5 (from tensorboard)
Using cached google_auth_oauthlib-1.0.0-py2.py3-none-any.whl (18 kB)
Requirement already satisfied: markdown>=2.6.8 in d:\anaconda\envs\pytorch\lib\site-packages (from tensorboard) (3.4.1)
Requirement already satisfied: numpy>=1.12.0 in d:\anaconda\envs\pytorch\lib\site-packages (from tensorboard) (1.24.3)
Requirement already satisfied: protobuf>=3.19.6 in d:\anaconda\envs\pytorch\lib\site-packages (from tensorboard) (3.19.6)
Requirement already satisfied: requests<3,>=2.21.0 in d:\anaconda\envs\pytorch\lib\site-packages (from tensorboard) (2.31.0)
Requirement already satisfied: setuptools>=41.0.0 in d:\anaconda\envs\pytorch\lib\site-packages (from tensorboard) (59.5.0)
Collecting tensorboard-data-server<0.8.0,>=0.7.0 (from tensorboard)
Obtaining dependency information for tensorboard-data-server<0.8.0,>=0.7.0 from https://files.pythonhosted.org/packages/da/61/6e9ff8258422d287eec718872fb71e05324356722ab658c8afda25f51539/tensorboard_data_server-0.7.1-py3-none-any.whl.metadata
Using cached tensorboard_data_server-0.7.1-py3-none-any.whl.metadata (1.1 kB)
Requirement already satisfied: werkzeug>=1.0.1 in d:\anaconda\envs\pytorch\lib\site-packages (from tensorboard) (2.2.3)
Requirement already satisfied: wheel>=0.26 in d:\anaconda\envs\pytorch\lib\site-packages (from tensorboard) (0.38.4)
Requirement already satisfied: cachetools<6.0,>=2.0.0 in d:\anaconda\envs\pytorch\lib\site-packages (from google-auth<3,>=1.6.3->tensorboard) (4.2.2)
Requirement already satisfied: pyasn1-modules>=0.2.1 in d:\anaconda\envs\pytorch\lib\site-packages (from google-auth<3,>=1.6.3->tensorboard) (0.2.8)
Requirement already satisfied: six>=1.9.0 in d:\anaconda\envs\pytorch\lib\site-packages (from google-auth<3,>=1.6.3->tensorboard) (1.16.0)
Requirement already satisfied: rsa<5,>=3.1.4 in d:\anaconda\envs\pytorch\lib\site-packages (from google-auth<3,>=1.6.3->tensorboard) (4.7.2)
Collecting google-auth<3,>=1.6.3 (from tensorboard)
Obtaining dependency information for google-auth<3,>=1.6.3 from https://files.pythonhosted.org/packages/9c/8d/bff87fc722553a5691d8514da5523c23547f3894189ba03b57592e37bdc2/google_auth-2.22.0-py2.py3-none-any.whl.metadata
Using cached google_auth-2.22.0-py2.py3-none-any.whl.metadata (4.2 kB)
Requirement already satisfied: requests-oauthlib>=0.7.0 in d:\anaconda\envs\pytorch\lib\site-packages (from google-auth-oauthlib<1.1,>=0.5->tensorboard) (1.3.0)
Requirement already satisfied: urllib3<2.0 in d:\anaconda\envs\pytorch\lib\site-packages (from google-auth<3,>=1.6.3->tensorboard) (1.26.16)
Requirement already satisfied: importlib-metadata>=4.4 in d:\anaconda\envs\pytorch\lib\site-packages (from markdown>=2.6.8->tensorboard) (6.0.0)
Requirement already satisfied: charset-normalizer<4,>=2 in d:\anaconda\envs\pytorch\lib\site-packages (from requests<3,>=2.21.0->tensorboard) (2.0.4)
Requirement already satisfied: idna<4,>=2.5 in d:\anaconda\envs\pytorch\lib\site-packages (from requests<3,>=2.21.0->tensorboard) (3.4)
Requirement already satisfied: certifi>=2017.4.17 in d:\anaconda\envs\pytorch\lib\site-packages (from requests<3,>=2.21.0->tensorboard) (2023.7.22)
Requirement already satisfied: MarkupSafe>=2.1.1 in d:\anaconda\envs\pytorch\lib\site-packages (from werkzeug>=1.0.1->tensorboard) (2.1.1)
Requirement already satisfied: zipp>=0.5 in d:\anaconda\envs\pytorch\lib\site-packages (from importlib-metadata>=4.4->markdown>=2.6.8->tensorboard) (3.11.0)
Requirement already satisfied: pyasn1<0.5.0,>=0.4.6 in d:\anaconda\envs\pytorch\lib\site-packages (from pyasn1-modules>=0.2.1->google-auth<3,>=1.6.3->tensorboard) (0.4.8)
Requirement already satisfied: oauthlib>=3.0.0 in d:\anaconda\envs\pytorch\lib\site-packages (from requests-oauthlib>=0.7.0->google-auth-oauthlib<1.1,>=0.5->tensorboard) (3.2.2)
Downloading tensorboard-2.14.0-py3-none-any.whl (5.5 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 5.5/5.5 MB 18.1 kB/s eta 0:00:00
Downloading google_auth-2.22.0-py2.py3-none-any.whl (181 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 181.8/181.8 kB 31.0 kB/s eta 0:00:00
Downloading tensorboard_data_server-0.7.1-py3-none-any.whl (2.4 kB)
Installing collected packages: tensorboard-data-server, google-auth, google-auth-oauthlib, tensorboard
Attempting uninstall: tensorboard-data-server
Found existing installation: tensorboard-data-server 0.6.1
Uninstalling tensorboard-data-server-0.6.1:
Successfully uninstalled tensorboard-data-server-0.6.1
Attempting uninstall: google-auth
Found existing installation: google-auth 2.6.0
Uninstalling google-auth-2.6.0:
Successfully uninstalled google-auth-2.6.0
Attempting uninstall: google-auth-oauthlib
Found existing installation: google-auth-oauthlib 0.4.4
Uninstalling google-auth-oauthlib-0.4.4:
Successfully uninstalled google-auth-oauthlib-0.4.4
Successfully installed google-auth-2.22.0 google-auth-oauthlib-1.0.0 tensorboard-2.14.0 tensorboard-data-server-0.7.1
卸载setuptools。
(pytorch) PS D:\Code\Python\torch_test> pip uninstall setuptools
Found existing installation: setuptools 59.5.0
Uninstalling setuptools-59.5.0:
Would remove:
d:\anaconda\envs\pytorch\lib\site-packages\_distutils_hack\*
d:\anaconda\envs\pytorch\lib\site-packages\distutils-precedence.pth
d:\anaconda\envs\pytorch\lib\site-packages\pkg_resources\*
d:\anaconda\envs\pytorch\lib\site-packages\setuptools-59.5.0.dist-info\*
d:\anaconda\envs\pytorch\lib\site-packages\setuptools\*
Would not remove (might be manually added):
d:\anaconda\envs\pytorch\lib\site-packages\pkg_resources\_vendor\importlib_resources\__init__.py
d:\anaconda\envs\pytorch\lib\site-packages\pkg_resources\_vendor\importlib_resources\_adapters.py
d:\anaconda\envs\pytorch\lib\site-packages\pkg_resources\_vendor\importlib_resources\_common.py
d:\anaconda\envs\pytorch\lib\site-packages\pkg_resources\_vendor\importlib_resources\_compat.py
d:\anaconda\envs\pytorch\lib\site-packages\pkg_resources\_vendor\importlib_resources\_itertools.py
d:\anaconda\envs\pytorch\lib\site-packages\pkg_resources\_vendor\importlib_resources\_legacy.py
d:\anaconda\envs\pytorch\lib\site-packages\pkg_resources\_vendor\importlib_resources\abc.py
d:\anaconda\envs\pytorch\lib\site-packages\pkg_resources\_vendor\importlib_resources\readers.py
d:\anaconda\envs\pytorch\lib\site-packages\pkg_resources\_vendor\importlib_resources\simple.py
d:\anaconda\envs\pytorch\lib\site-packages\pkg_resources\_vendor\jaraco\__init__.py
d:\anaconda\envs\pytorch\lib\site-packages\pkg_resources\_vendor\jaraco\context.py
d:\anaconda\envs\pytorch\lib\site-packages\pkg_resources\_vendor\jaraco\functools.py
d:\anaconda\envs\pytorch\lib\site-packages\pkg_resources\_vendor\jaraco\text\__init__.py
d:\anaconda\envs\pytorch\lib\site-packages\pkg_resources\_vendor\more_itertools\__init__.py
d:\anaconda\envs\pytorch\lib\site-packages\pkg_resources\_vendor\more_itertools\more.py
d:\anaconda\envs\pytorch\lib\site-packages\pkg_resources\_vendor\more_itertools\recipes.py
d:\anaconda\envs\pytorch\lib\site-packages\pkg_resources\_vendor\packaging\_elffile.py
d:\anaconda\envs\pytorch\lib\site-packages\pkg_resources\_vendor\packaging\_parser.py
d:\anaconda\envs\pytorch\lib\site-packages\pkg_resources\_vendor\packaging\_tokenizer.py
d:\anaconda\envs\pytorch\lib\site-packages\pkg_resources\_vendor\packaging\metadata.py
d:\anaconda\envs\pytorch\lib\site-packages\pkg_resources\_vendor\platformdirs\__init__.py
d:\anaconda\envs\pytorch\lib\site-packages\pkg_resources\_vendor\platformdirs\__main__.py
d:\anaconda\envs\pytorch\lib\site-packages\pkg_resources\_vendor\platformdirs\android.py
d:\anaconda\envs\pytorch\lib\site-packages\pkg_resources\_vendor\platformdirs\api.py
d:\anaconda\envs\pytorch\lib\site-packages\pkg_resources\_vendor\platformdirs\macos.py
d:\anaconda\envs\pytorch\lib\site-packages\pkg_resources\_vendor\platformdirs\unix.py
d:\anaconda\envs\pytorch\lib\site-packages\pkg_resources\_vendor\platformdirs\version.py
d:\anaconda\envs\pytorch\lib\site-packages\pkg_resources\_vendor\platformdirs\windows.py
d:\anaconda\envs\pytorch\lib\site-packages\pkg_resources\_vendor\typing_extensions.py
d:\anaconda\envs\pytorch\lib\site-packages\pkg_resources\_vendor\zipp.py
d:\anaconda\envs\pytorch\lib\site-packages\setuptools\_distutils\_collections.py
d:\anaconda\envs\pytorch\lib\site-packages\setuptools\_distutils\_functools.py
d:\anaconda\envs\pytorch\lib\site-packages\setuptools\_distutils\_log.py
d:\anaconda\envs\pytorch\lib\site-packages\setuptools\_distutils\_macos_compat.py
d:\anaconda\envs\pytorch\lib\site-packages\setuptools\_distutils\command\_framework_compat.py
d:\anaconda\envs\pytorch\lib\site-packages\setuptools\_distutils\py39compat.py
d:\anaconda\envs\pytorch\lib\site-packages\setuptools\_entry_points.py
d:\anaconda\envs\pytorch\lib\site-packages\setuptools\_importlib.py
d:\anaconda\envs\pytorch\lib\site-packages\setuptools\_itertools.py
d:\anaconda\envs\pytorch\lib\site-packages\setuptools\_normalization.py
d:\anaconda\envs\pytorch\lib\site-packages\setuptools\_path.py
d:\anaconda\envs\pytorch\lib\site-packages\setuptools\_reqs.py
d:\anaconda\envs\pytorch\lib\site-packages\setuptools\_vendor\importlib_metadata\__init__.py
d:\anaconda\envs\pytorch\lib\site-packages\setuptools\_vendor\importlib_metadata\_adapters.py
d:\anaconda\envs\pytorch\lib\site-packages\setuptools\_vendor\importlib_metadata\_collections.py
d:\anaconda\envs\pytorch\lib\site-packages\setuptools\_vendor\importlib_metadata\_compat.py
d:\anaconda\envs\pytorch\lib\site-packages\setuptools\_vendor\importlib_metadata\_functools.py
d:\anaconda\envs\pytorch\lib\site-packages\setuptools\_vendor\importlib_metadata\_itertools.py
d:\anaconda\envs\pytorch\lib\site-packages\setuptools\_vendor\importlib_metadata\_meta.py
d:\anaconda\envs\pytorch\lib\site-packages\setuptools\_vendor\importlib_metadata\_py39compat.py
d:\anaconda\envs\pytorch\lib\site-packages\setuptools\_vendor\importlib_metadata\_text.py
d:\anaconda\envs\pytorch\lib\site-packages\setuptools\_vendor\importlib_resources\__init__.py
d:\anaconda\envs\pytorch\lib\site-packages\setuptools\_vendor\importlib_resources\_adapters.py
d:\anaconda\envs\pytorch\lib\site-packages\setuptools\_vendor\importlib_resources\_common.py
d:\anaconda\envs\pytorch\lib\site-packages\setuptools\_vendor\importlib_resources\_compat.py
d:\anaconda\envs\pytorch\lib\site-packages\setuptools\_vendor\importlib_resources\_itertools.py
d:\anaconda\envs\pytorch\lib\site-packages\setuptools\_vendor\importlib_resources\_legacy.py
d:\anaconda\envs\pytorch\lib\site-packages\setuptools\_vendor\importlib_resources\abc.py
d:\anaconda\envs\pytorch\lib\site-packages\setuptools\_vendor\importlib_resources\readers.py
d:\anaconda\envs\pytorch\lib\site-packages\setuptools\_vendor\importlib_resources\simple.py
d:\anaconda\envs\pytorch\lib\site-packages\setuptools\_vendor\jaraco\__init__.py
d:\anaconda\envs\pytorch\lib\site-packages\setuptools\_vendor\jaraco\context.py
d:\anaconda\envs\pytorch\lib\site-packages\setuptools\_vendor\jaraco\functools.py
d:\anaconda\envs\pytorch\lib\site-packages\setuptools\_vendor\jaraco\text\__init__.py
d:\anaconda\envs\pytorch\lib\site-packages\setuptools\_vendor\packaging\_elffile.py
d:\anaconda\envs\pytorch\lib\site-packages\setuptools\_vendor\packaging\_parser.py
d:\anaconda\envs\pytorch\lib\site-packages\setuptools\_vendor\packaging\_tokenizer.py
d:\anaconda\envs\pytorch\lib\site-packages\setuptools\_vendor\packaging\metadata.py
d:\anaconda\envs\pytorch\lib\site-packages\setuptools\_vendor\tomli\__init__.py
d:\anaconda\envs\pytorch\lib\site-packages\setuptools\_vendor\tomli\_parser.py
d:\anaconda\envs\pytorch\lib\site-packages\setuptools\_vendor\tomli\_re.py
d:\anaconda\envs\pytorch\lib\site-packages\setuptools\_vendor\tomli\_types.py
d:\anaconda\envs\pytorch\lib\site-packages\setuptools\_vendor\typing_extensions.py
d:\anaconda\envs\pytorch\lib\site-packages\setuptools\_vendor\zipp.py
d:\anaconda\envs\pytorch\lib\site-packages\setuptools\command\build.py
d:\anaconda\envs\pytorch\lib\site-packages\setuptools\command\editable_wheel.py
d:\anaconda\envs\pytorch\lib\site-packages\setuptools\config\__init__.py
d:\anaconda\envs\pytorch\lib\site-packages\setuptools\config\_apply_pyprojecttoml.py
d:\anaconda\envs\pytorch\lib\site-packages\setuptools\config\_validate_pyproject\__init__.py
d:\anaconda\envs\pytorch\lib\site-packages\setuptools\config\_validate_pyproject\error_reporting.py
d:\anaconda\envs\pytorch\lib\site-packages\setuptools\config\_validate_pyproject\extra_validations.py
d:\anaconda\envs\pytorch\lib\site-packages\setuptools\config\_validate_pyproject\fastjsonschema_exceptions.py
d:\anaconda\envs\pytorch\lib\site-packages\setuptools\config\_validate_pyproject\fastjsonschema_validations.py
d:\anaconda\envs\pytorch\lib\site-packages\setuptools\config\_validate_pyproject\formats.py
d:\anaconda\envs\pytorch\lib\site-packages\setuptools\config\expand.py
d:\anaconda\envs\pytorch\lib\site-packages\setuptools\config\pyprojecttoml.py
d:\anaconda\envs\pytorch\lib\site-packages\setuptools\config\setupcfg.py
d:\anaconda\envs\pytorch\lib\site-packages\setuptools\discovery.py
d:\anaconda\envs\pytorch\lib\site-packages\setuptools\logging.py
d:\anaconda\envs\pytorch\lib\site-packages\setuptools\py312compat.py
d:\anaconda\envs\pytorch\lib\site-packages\setuptools\warnings.py
Proceed (Y/n)? y
Successfully uninstalled setuptools-59.5.0
(pytorch) PS D:\Code\Python\torch_test> conda install setuptools==58.0.4
Collecting package metadata (current_repodata.json): done
Solving environment: unsuccessful initial attempt using frozen solve. Retrying with flexible solve.
Collecting package metadata (repodata.json): done
Solving environment: done
## Package Plan ##
environment location: D:\Anaconda\envs\pytorch
added / updated specs:
- setuptools==58.0.4
The following packages will be downloaded:
package | build
---------------------------|-----------------
setuptools-58.0.4 | py38haa95532_0 779 KB
wincertstore-0.2 | py38haa95532_2 15 KB
------------------------------------------------------------
Total: 794 KB
The following NEW packages will be INSTALLED:
wincertstore pkgs/main/win-64::wincertstore-0.2-py38haa95532_2
The following packages will be DOWNGRADED:
setuptools 68.0.0-py38haa95532_0 --> 58.0.4-py38haa95532_0
Proceed ([y]/n)? y
Downloading and Extracting Packages
Preparing transaction: done
Verifying transaction: done
Executing transaction: done
3、使用tensorboard
在cmd中使用tensorboard命令,点击链接查看数据。
(pytorch) PS D:\Code\Python\torch_test> tensorboard --logdir=logs
TensorFlow installation not found - running with reduced feature set.
Serving TensorBoard on localhost; to expose to the network, use a proxy or pass --bind_all
TensorBoard 2.14.0 at http://localhost:6006/ (Press CTRL+C to quit)