如何创建需要另一个正则表达式模块的 python 包 're'

How to create a python package that requires another module of regular expressions 're'

我正在创建一个 python 包。这会使用正则表达式 're' 模块和 returns 预处理文本对输入文本进行一些预处理。我的问题是如何在我正在创建的 python 包中导入 're' 。我是新手,第一次写 python 包。

我的setup.py文件内容如下:

from setuptools import setup 
import re

setup(name ="speech_text",
    version = "0.1",
    description = "preprocess text",
    long_description = "preprocess text", 
    packages = ['speech_text'],
    install_requires = ['re'])

'speech_text' 是我正在创建的包的名称。我试过这种方式,但它抛出如下错误:

ERROR: Could not find a version that satisfies the requirement re (from speech-text==0.1) (from versions: none) ERROR: No matching distribution found for re (from speech-text==0.1)

speech_text.py 是完成所有预处理的文件。我也在那里导入了 're' 模块。但是,我无法摆脱这两个错误。所以,我的问题是如何在我的包代码中导入 're' 模块并使用它。

re 是 Python 标准库的一部分,你根本不应该在你的 install_requires 参数中包含它,它会一直存在。