主要命令
- 检查
$ python setup.py check
- 打包
这里注意python版本,可能需要使用python3
$ python setup.py sdist bdist_wheel || true
打包过程
以SudachiDict-core-20211220
为例。
- 下载并解压
.tar.gz
文件 - 准备工作
进入根目录(根目录中有setup.py
文件)
SudachiDict-core-20211220
打包过程会下载字典,打开setup.py
文件,注释或删除下面的行。因为该字典在外网,一般会因为下载速度慢而失败。
if not os.path.exists(RESOURCE_DIR):
logger.warning("Downloading the Sudachi dictionary (It may take a while) ...")
_, _msg = urlretrieve(ZIP_URL, ZIP_NAME)
with ZipFile(ZIP_NAME) as z:
z.extractall()
改为以下内容,因为下载很慢会一直失败,需要手动下载字典然后放入目录中。
if not os.path.exists(RESOURCE_DIR):
logger.warning("Downloading the Sudachi dictionary (It may take a while) ...")
# _, _msg = urlretrieve(ZIP_URL, ZIP_NAME)
with ZipFile(ZIP_NAME) as z:
z.extractall()
- 检查
$ python setup.py check
- 执行打包命令
$ python setup.py sdist bdist_wheel || true
至此会在根目录中的dist
目录中生成.whl
文件
v1.5.2