我正在尝试使用distutils / setup.py等添加我写给PyPi的模块。一切顺利,除了为了访问模块(在pip安装之后)我必须这样做:
from svdRec import svdRec
svd = svdRec.svdRec()
理想情况下,我想这样做:
import svdRec
svd = svdRec.svdRec()
我的文件结构是这样的:
svdRec
... setup.py
... README.md
... setup.cfg
... MANIFEST
... svdRec/
... ... svdRec.py
我的setup.py看起来像这样:
from distutils.core import setup
setup(
name = 'svdRec',
packages = ['svdRec'], # this must be the same as the name above
version = '0.1.2',
description = 'A Python3 Collaborative Recommendation Engine with Sparse Matrices',
author = 'REDACTED',
author_email = 'REDACTED',
url = 'https://github.com/REDACTED', # use the URL to the github repo
download_url = 'https://github.com/REDACTED', # Points to the github TAR file made by tagging
keywords = ['recommender', 'sparse', 'matrix', 'recsys', 'svd'], # arbitrary keywords
classifiers = [],
install_requires = ['scipy','numpy'], # required packages
)
这是我第一次尝试使模块可以安装,所以任何指导都会非常感谢它如何通过一次调用使模块可以暴露而不需要做
from PACKAGE import MODULE