Mac ml-agents release 19(v0
Mac ml-agents release 19(v0.28.0)踩雷
主要参考这篇博客:
跟着这篇安装完,在激活虚拟环境的终端输入mlagents-learn检验,如果正常应输出如下:
后面超时报错不用管,因为还没在unity中启动训练环境。
但是在跟完这篇博客后我这里并未成功执行此命令,报了几个错,下面是报错和对应解决方式:
! python3.8!!!!!!python3.8!!!!!博客里pytorch的下载那个cpu/torch-1.9.0-cp38-none-macosx_11_0_arm64.whl
的38是指的py3.8,第一次用了3.9环境报了没能解决的错,重开了
1.protobuf要降级
-终端报错:
...
File "/opt/anaconda3/envs/ml-agents/lib/python3.8/site-packages/google/protobuf/descriptor.py", line 621, in __new__
_message.Message._CheckCalledFromGeneratedFile()
TypeError: Descriptors cannot 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).
...
(ml-agents) acciomac@acciomacdeMacBook-Pro ml-agents-release_19 % pip install 'protobuf<=3.20.1' --force-reinstall
-解决方式:
来源:https://stackoverflow.com/questions/72441758/typeerror-descriptors-cannot-not-be-created-directly
采用命令,强制降级:
pip install 'protobuf<=3.20.1' --force-reinstall
2.numpy的np.float被弃用导致
-终端报错:
File "/opt/anaconda3/envs/ml-agents/lib/python3.8/site-packages/numpy/__init__.py", line 305, in __getattr__
raise AttributeError(__former_attrs__[attr])
AttributeError: module 'numpy' has no attribute 'float'.
`np.float` was a deprecated alias for the builtin `float`. To avoid this error in existing code, use `float` by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use `np.float64` here.
The aliases was originally deprecated in NumPy 1.20; for more details and guidance see the original release note at:
https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations
-解决方式:
参考:https://blog.csdn.net/qq_45934285/article/details/131120167
可以改代码,但不方便,我直接降级了。
采用命令:
conda install numpy==1.23.5
3.没有six
Module
-终端报错:
File "/opt/anaconda3/envs/ml-agents/lib/python3.8/site-packages/torch/utils/tensorboard/summary.py", line 8, in <module>
from six.moves import range
ModuleNotFoundError: No module named 'six'
-解决方式:
下就好了,采用命令:
pip install six
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· 单线程的Redis速度为什么快?
· SQL Server 2025 AI相关能力初探
· AI编程工具终极对决:字节Trae VS Cursor,谁才是开发者新宠?
· 展开说说关于C#中ORM框架的用法!