我有一个要在本地构建的软件包,可以在嵌入式环境中使用。
我正在尝试自动生成控制台脚本,因此我在entry_points内部使用console_scripts,如下所示:
setup(...,
entry_points={
'console_scripts': [
'app=x.y:main'
]
},
# Below is added as the other tried methods failed.
options={
'build_scripts': {
'executable': '/bin/custom_python',
},
}
)
我试图设置在我的entry_point中使用的python解释器,因为它与构建系统内部的python解释器不同。但是无论我尝试什么,它始终设置为本地解释器。
我尝试了几种选择,例如:
但以上方法均无效。我想知道我是否缺少什么?
答案 0 :(得分:1)
所以最后我设法做到了。
首先,我必须在设置调用中添加以下内容,这在各种帖子中都得到了建议:
options={
'build_scripts': {
'executable': '/bin/custom_python',
},
}
现在,我像往常一样构建和安装该软件包。就我而言,我创建了一个轮子并安装:
python3 setup.py sdist bdist_wheel -d wheels
pip3 install --no-deps -U --prefix $TARGET_INSTALL wheels/mypackage.whl
上面将对创建的脚本使用本地python解释器
要解决此问题,请运行以下命令:
python3 setup.py install_scripts -d $TARGET_INSTALL/bin
用'build_scripts'选项中传递的正确脚本替换脚本。
但是我仍然想知道在用pip安装轮子时是否有办法直接获取正确的解释器?
答案 1 :(得分:0)
尝试
python setup.py build --executable /bin/custom_python
python setup.py install # or bdist_egg/bdist_wheel