无法导入我新创建的 python 包未找到模块

问题描述

所以我最近开发了我的第一个python库,但是我在测试时尝试从pip下载包,但即使下载成功,我也无法导入。

Setup.py:

from setuptools import find_packages,setup
import pathlib

README = (pathlib.Path(__file__).parent / "README.md").read_text(encoding='utf8')

setup(
    name='pretty-downloader',packages=find_packages(),version='0.0.4',description='This is a simple python pretty downloader for your projects.',long_description=README,long_description_content_type='text/markdown',author='DeadSec-Security',author_email='amng835@gmail.com',url='https://github.com/DEADSEC-Security/pretty-downloader',keywords=[
        'progressbar','downloader','download','console','bar','progress','download-bar'
    ],license='MIT',install_requires=[
        'tqdm==4.57.0','requests==2.25.1'
    ],setup_requires=['pytest-runner'],tests_require=['pytest==6.2.2'],python_requires='>=3.7'
)

终端输出

enter image description here

GitHub repo

Pypi repo

免责声明:我无意以任何方式宣传我的图书馆。这是我面临的一个实际问题,因为这是我第一次开发这样的库。

解决方法

我相信您只需要在 __init__.py 文件夹中添加一个 pretty_downloader 文件,其中包含以下内容

from .pretty_downloader import download