Ich mache eine einfache Python-App. Ich weiß nicht, ob ich es richtig mache oder nicht so korrigieren Sie mich bitte in den Kommentaren oder wenn Sie eine Antwort auf dieseImportError beim Ausführen von Python setup.py Test
Fehler: ImportError: No module named 'taskhandler'
und ImportError: No module named 'styles' while doing
python3 setup.py test`
Dateistruktur:
.
├── MANIFEST.in
├── pydotask.egg-info
│ ├── dependency_links.txt
│ ├── not-zip-safe
│ ├── PKG-INFO
│ ├── SOURCES.txt
│ └── top_level.txt
├── README.md
├── setup.py
├── task_mod
│ ├── __init__.py
│ ├── __pycache__
│ │ ├── __init__.cpython-35.pyc
│ │ ├── pydo.cpython-35.pyc
│ │ └── taskhandler.cpython-35.pyc
│ ├── pydo.py
│ ├── styles
│ │ ├── __init__.py
│ │ ├── __pycache__
│ │ │ ├── __init__.cpython-35.pyc
│ │ │ ├── termcolor.cpython-35.pyc
│ │ │ └── text_style.cpython-35.pyc
│ │ ├── termcolor.py
│ │ └── text_style.py
│ ├── taskhandler.py
│ └── tasks.csv
└── update.txt
5 directories, 22 files
'task_mod/pydo.py':
#!/usr/bin/env python3
''' To Do App in Python '''
import sys, os
import taskhandler as task
from styles import text_style as text
from styles import termcolor
task_mod/taskhandler.py
:
#!/usr/bin/env python3
import sys, os
import csv
from styles import termcolor
from styles import text_style as text
setup.py
from setuptools import setup
def readme():
with open('README.md') as readme:
return readme.read()
setup(
name = 'pydotask',
version = '0.2',
description = 'PyDo is a CLI Application to keep you on track with your tasks and projects',
long_description = readme(),
classifiers = [
'Development Status :: 3 - Alpha',
'Programming Language :: Python :: 3.5',
'Topic :: Office/Business :: Scheduling'
],
keywords = 'utilities office schedule task reminder',
url = '',
author = 'Abhishta Gatya',
author_email = '[email protected]',
packages = ['task_mod'],
scripts = ['task_mod/pydo'],
python_requires = '>=3',
include_package_data = True,
zip_safe = False
)
So, wie ich dieses Problem bekommen?
Hinweis: Wenn ich python3 task_mod/pydo.py
ausführen, funktioniert es gut! aber wenn ich versuche es zu testen gibt es 2 Importfehler
Ist das nicht wegen der Zeile '#!/Usr/bin/env python3' am Anfang von' pydo.py' und 'taskhandler.py'? – Iva
@Iva das ist nur der Interpreter Pfad – Steampunkery
ist das, was es verursacht hat? hängen Sie auf –