Following the PYPI documentation, it shows how to install a package, which works great. But once I introduce a class to a file I can't located the class. I've attached a lot of code but i believe the context is necessary.
Now this works fine when I'm working in the directory but once its uploaded to PYPI and used elsewhere on my computer it can't find the class.
Tree
package_upload
├── EasyNN
│?? ├── EasyNN.py
│?? ├── __init__.py
│?? └── import_this.py
├── LICENSE.txt
├── README.md
└── setup.py
Setup.py
import setuptools
with open("README.md", "r", encoding="utf-8") as fh:
long_description = fh.read()
setuptools.setup(
name='EasyNN',
version='0.0.3',
description='Currently Testing',
packages=setuptools.find_packages(),
python_requires='>=3.6',
url="https://github.com/danielwilczak101/EasyNN",
author="Daniel",
author_email="daniel@gmail.com",
long_description = long_description,
long_description_content_type = "text/markdown",
classifier=[
"Programming Language :: Python :: 3",
"License :: OSI Approved :: GNU General Public License v2 or later (GPLv2+)",
"Operating System :: OS Independent",
],
install_requires = ["matplotlib ~= 3.3.2",
"pytest>=3.7",
"tabulate >=0.8.7"
],
)
EasyNN.py
import import_this
class NN:
def say_hello(self):
print("Hello NN World!")
import_this.py
def foo():
print("I've been imported")
Running Python Code
import EasyNN
nn = EasyNN.NN()
Error
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: module 'EasyNN' has no attribute 'NN'
>>>
question from:
https://stackoverflow.com/questions/65916756/python-package-structure-not-importing-correct-module 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…