python - 无法导入我新创建的 python 包(未找到模块)
问题描述
所以我最近开发了我的第一个python库,但是我在测试的时候尝试从pip下载包,但是即使下载成功了,我也无法导入它。
安装程序.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'
)
终端的输出:
免责声明:我绝不会试图宣传我的图书馆。这是我面临的一个真正问题,因为这是我第一次开发这样的库。
解决方案
我相信你只需要在文件夹中添加一个__init__.py
文件,pretty_downloader
内容如下
from .pretty_downloader import download
推荐阅读
- c# - 如何获得 TimePicker 的值?
- javascript - Javascript打印功能打破下拉表单提交更改
- python - 使用 nltk 和 word net 将单词从过去时变为将来时
- json - 使用 Unix 工具解析 JSON 数组
- git - 查找已签出/添加的子树的哪个分支
- google-cloud-platform - 如何在 vpc 内的 gcs 存储桶上托管静态网站?
- python - 从列表python中删除非数值
- arrays - 如何对 UNIQUE ARRAY 公式的一部分求和
- css - CSS 每日计划布局上的粘性顶栏和侧栏
- jinja2 - Jinja2 - 如何根据 if else 条件为变量赋值?