The following operations is under Win10:
- the dictionary structure:
│ LICENSE
│ README.md
│ setup.py
│
└─dlpk
a.py
b.py
__init__.py
- the contents of the files:
the __init__.py
is empty.
# b.py:
from a import A
# a.py:
class A:
pass
# setup.py:
import setuptools
with open("README.md", "r", encoding="utf-8") as fh:
long_description = fh.read()
setuptools.setup(
name="testDL-DeaL",
version="0.0.9",
author="Dai Ling",
author_email="dialing57@163.com",
description="error report",
long_description=long_description,
long_description_content_type="text/markdown",
url="https://github.com/dailing57/DLex",
classifiers=[
"Programming Language :: Python :: 3",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
],
packages=setuptools.find_packages(),
python_requires=">=3.6",
)
- Execute following commands:
python setup.py sdist
twine upload --repository testpypi dist/*
- Import it from the test.pypi create and activate the venv
do
pip install --index-url https://test.pypi.org/simple/ --no-deps testDL-DeaL==0.0.9
write a test file: test.py
:
from dlpk import b
and run it, it shows:
Traceback (most recent call last):
File "H:\DLang\TEST\test.py", line 1, in <module>
from dlpk import b
File "H:\DLang\TEST\venv\lib\site-packages\dlpk\b.py", line 1, in <module>
from a import A
ModuleNotFoundError: No module named 'a'
How does this error happen?