pip install wheel 后导入模块

import module after pip install wheel

我有一个自定义构建的模块,我们将其命名为 abcpip install /local_path/abc-0.1-py3-none-any.whl。安装正确,

>>pip install dist/abc-0.1-py3-none-any.whl
Processing ./dist/abc-0.1-py3-none-any.whl
Successfully installed abc-0.1

但是我无法导入模块。 在我 运行 ppip freeze list 之后发现列表中的模块名称是 abc @ file:///local_path/abc-0.1-py3-none-any.whl
我的问题是如何导入模块?谢谢

.
├── requirements.txt
├── setup.py
├── src
│   ├── bin
│   │   ├── __init__.py
│   │   ├── xyz1.py
│   │   ├── xyz2.py
│   │   └── xyz3.py

这是我的 setup.py

with open("requirements.txt") as f:
    install_requires = f.read()

setup(
    name="abc",
    version="0.1",
    author="galaxyan",
    author_email="galaxyan@123.com",
    description="test whell framework",
    packages=find_packages(include=["src"]),
    zip_safe=False,
    install_requires=install_requires,
)

############更新############
即使更改 setup.py

也不起作用
with open("requirements.txt") as f:
    install_requires = f.read()

setup(
    name="abc",
    version="0.1",
    author="galaxyan",
    author_email="galaxyan@123.com",
    description="test whell framework",
    packages=find_packages(where="src"),
    package_dir={"": "src"},
    zip_safe=False,
    install_requires=install_requires,
)

setup.py 是错误的,这意味着您正在构建一个实际上没有包的轮子。

而不是

setup(
    ...
    packages=find_packages(include=["src"]),
    ...
)

试试这个:

setup(
    ...
    packages=find_packages(where="src"),
    package_dir={"": "src"},
    ...
)

有关详细信息,请参阅 Testing & Packaging