赞
踩
新换了操作系统,从ubuntu20.04升级到22.04,使用ROS2 humble,编译的时候总是报这个错误,
c:\python38\lib\site-packages\setuptools\_distutils\cmd.py:66: SetuptoolsDeprecationWarning: setup.py install is deprecated.
!!
********************************************************************************
Please avoid running ``setup.py`` directly.
Instead, use pypa/build, pypa/installer or other
standards-based tools.
See https://blog.ganssle.io/articles/2021/10/setup-py-deprecated.html for details.
********************************************************************************
!!
self.initialize_options()
---
网上有说是版本问题,看了一下,官方明文说是要用
python -m pip install -U pip setuptools==59.6.0
参考地址:Windows (binary) — ROS 2 Documentation: Humble documentation
看了一下我的版本,也没问题,但错误(其实是警告,可以不理会)仍旧 。
后来看到一个贴子说要用58.2,
pip install setuptools==58.2.0 ( all above versions do not work )
原因是因为新的版本在改python的build方式,因为我一起用python3.8, python3.9,没有发现过这个问题,当前用的是python3.8.3 + ubuntu22.04 + setuptools59.6,所以不应该是python10在捣鬼,于是把setuptools降到58.2,果然警告消除了。
问题是临时解决了,但原因还是不清楚,上stackoverflow,
然后根据报错提示找到这个,
https://blog.ganssle.io/articles/2021/10/setup-py-deprecated.html#summary
总之,叽哩咕噜解释半天,就是setup.py确实要停用了,你可以用这个那个啥啥啥来替代,更自由啥啥啥的,如下,
setup.py command | New command |
---|---|
setup.py sdist setup.py bdist_wheel | python -m build (with build) |
setup.py test | pytest (usually via tox or nox) |
setup.py install | pip install |
setup.py develop | pip install -e |
setup.py upload | twine upload (with twine) |
setup.py check | twine check (this doesn't do all the same checks but it's a start) |
Custom commands | tox and nox environments. |
权威的说法在这个PEP517,
https://peps.python.org/pep-0517/
本文结束。
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。