Pytorch学习中可能遇到的问题

1.pycharm中无法使用conda activate 命令激活conda环境的解决办法

         1.打开pycharm,File -> Settings -> Tools -> Terminal

   2,在Shell path(shell路径)那里,

用:cmd.exe "/K"  D:\Anaconda\Scripts\activate.bat  your_environment_name 替换原来的路径

其中”your_environment_name“要替换成你已经创建的conda虚拟环境。” D:\Anaconda\Scripts\activate.bat“替换成你的conda安装路径中Scripts\activate.bat文件的位置。

   3,配置好之后点击应用,重启pycharm终端就正常了!

2,报错:TypeError: Descriptors cannot not be created directly. If this call came from a _pb2.py file, your generated code is out of date and must be regenerated with protoc >= 3.19.0. If you cannot immediately regenerate your protos, some other possible workarounds are: 1. Downgrade the protobuf package to 3.20.x or lower. 2. Set PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python (but this will use pure-Python parsing and will be much slower).

类型错误:无法直接创建描述符。
如果此调用来自_pb2.py文件,则生成的代码已过期,必须使用protoc>=3.1.0重新生成。

解决办法:

pip install protobuf==3.19.0

3,调取tensorboard报错:TypeError: MessageToJson() got an unexpected keyword argument including 

  训练时调取tensorboard报错:TypeError: MessageToJson() got an unexpected keyword argument including。并且没有显示图像。这是由于tensorboard版本过高导致,只需要将tensorboard版本降低即可。降低至2.1.0便可以正常使用。

 激活虚拟环境 conda activate 虚拟环境
 降低tensorboard版本为2.1.0

 pip install tensorboard==2.1.0

4,问题描述
raise AttributeError("module {!r} has no attribute "
AttributeError: module ‘numpy’ has no attribute ‘int’

原因分析:
numpy版本太高,下一个低版本即可
解决方案:

pip install numpy==1.21 -i https://pypi.tuna.tsinghua.edu.cn/simple

      

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值