我将来自https://github.com/yoctocookbook/meta-custom/tree/master/recipes-python/python-helloworld的python helloworld添加到我的yocto构建中,效果很好。这些文件将被预编译并复制到映像:
ls /usr/lib/python2.7/site-packages/helloworld
__init__.py __init__.pyc main.py main.pyc
我需要用Python3。将配方中的inherit setuptools
更改为inherit setuptools3
会将python 3.7改为2.7添加到我的图像中,脚本也可以工作,但预编译的文件现在位于子文件夹__pycache__
中,扩展名为:
ls /usr/lib/python3.7/site-packages/helloworld/__pycache__/
__init__.cpython-37.pyc main.cpython-37.pyc
我想从目标版本中删除.py源代码文件。
使用setuptools
我可以删除.py文件,并且脚本可以使用.pyc文件正常工作。使用setuptools3
,python3在删除.py文件后引发ModuleNotFoundError
。你知道吗
移动和重命名(如__pycache__/main.cpython-37.pyc
到main.pyc
)它又能工作了。你知道吗
告诉setuptools3
以与setuptools
相同的方式创建precompiles.pyc文件以避免这种移动和重命名的正确方法是什么?你知道吗
目前没有回答
相关问题 更多 >
编程相关推荐