'''
#1. 目录结构
myutils —— setup.py
|
—— src —— __init__.py
|
—— myutils —— a.py
|
—— b.py
|
—— __init__.py
'''
#2. 在 setup.py 中写入
from distutils.core import setup
from setuptools import find_packages
setup(name = 'anyuzkits', # 包名
version = '1.0.0', # 版本号
description = '',
long_description = '',
author = '',
author_email = '',
url = '',
license = '',
install_requires = [],
classifiers = [
'Intended Audience :: Developers',
'Operating System :: OS Independent',
'Natural Language :: Chinese (Simplified)',
'Programming Language :: Python :: 3.6',
'Topic :: Utilities'
],
keywords = '',
packages = find_packages('src'), # 必填
package_dir = {'':'src'}, # 必填
include_package_data = True,
)
#3. 在 myutils 文件夹的 __init__.py 中写入
from __future__ import absolute_import
from .a import *
from .b import *
__version__ = '1.0.0'
__license__ = ''
#4. 在 setup.py 目录中执行
python setup.py sdist # 生产压缩包
python setup.py install # 安装模块
Python 如何将自定义模块导入系统模块
最新推荐文章于 2024-01-31 08:40:06 发布