我很喜欢使用一个工具 GitHub - HFrost0/bilix: ⚡️Lightning-fast async download tool for bilibili and more ,pip install 这个包后,只要在终端输入一行命令,就可以方便快捷下载我想要的视频
bilix v 视频链接
最近我在写一些rime输入法相关的工具 GitHub - whitewatercn/rimetool: 一些rime使用工具
我也想实现类似的效果,目前已经做到下载源码后,通过一行命令来把vcf文件转换成rime词库
python rimetool.py -vcf 文件路径
但我想进一步实现pip安装后,直接在终端操作,比如
rimetool -vcf 文件路径
我查了一些资料,基本完成了setup.py
,但是当我使用python setup.py develop
本地部署后,在终端操作rimetool -vcf 文件路径
,却报错
Traceback (most recent call last):
File "/Users/whitewatercn/miniconda3/envs/torch/bin/rimetool", line 33, in <module>
sys.exit(load_entry_point('rimetool', 'console_scripts', 'rimetool')())
File "/Users/whitewatercn/miniconda3/envs/torch/bin/rimetool", line 25, in importlib_load_entry_point
return next(matches).load()
File "/Users/whitewatercn/miniconda3/envs/torch/lib/python3.8/importlib/metadata.py", line 79, in load
return functools.reduce(getattr, attrs, module)
AttributeError: module 'rimetool' has no attribute 'main'
问了GitHub Copilot,也只是提醒我
从你提供的错误信息来看,Python在尝试运行rimetool模块的main函数时,找不到这个函数。这可能是因为rimetool模块中没有定义main函数,或者main函数的定义没有被正确地导入。
你提供的rimetool.py文件中的代码看起来是正确的,main函数已经被定义了。这可能是因为你的环境中有多个版本的rimetool,并且你正在运行的版本不是你期望的版本。你可以尝试卸载所有版本的rimetool,然后重新安装你的包。
如果问题仍然存在,你可能需要提供更多的信息,以便我能更好地帮助你解决问题。
但是我在rimetool.py里已经写好main()了呀,python学得不是很明白,求指教