AttributeError: module ‘setuptools._distutils‘ has no attribute ‘version‘

AttributeError: module ‘setuptools._distutils’ has no attribute ‘version’

问题描述:在pytorch中使用tensorboard时发生错误AttributeError: module ‘setuptools._distutils’ has no attribute ‘version’

from torch.utils.tensorboard import SummaryWriter

writer=SummaryWriter("logs")

# writer.add_image()      #图像
#y=x
for i in range(100):

    writer.add_scalar("y=x",i,i)    #标量

writer.close()

问题原因:

setuptools版本过高

解决方法:

安装低版本setuptools
在pycharm终端中输入:
pip uninstall setuptools
pip install setuptools==59.5.0 //需要比你之前的低
AttributeError: module ‘setuptools._distutils‘ has no attribute ‘version‘_第1张图片

你可能感兴趣的:(深度学习,pytorch,python,pycharm)