pip freeze
appdirs==1.4.4
argon2-cffi==20.1.0
attrs==20.1.0
backcall==0.2.0
bleach==3.1.5
certifi==2020.6.20
cffi==1.14.2
colorama==0.4.3
cycler==0.10.0
DateTime==4.3
decorator==4.4.2
defusedxml==0.6.0
distlib==0.3.1
entrypoints==0.3
filelock==3.0.12
importlib-metadata==1.7.0
importlib-resources==3.0.0
ipykernel==5.3.4
ipython==7.16.1
ipython-genutils==0.2.0
ipywidgets==7.5.1
jedi==0.17.2
Jinja2==2.11.2
jsonschema==3.2.0
jupyter==1.0.0
jupyter-client==6.1.7
jupyter-console==6.2.0
jupyter-core==4.6.3
kiwisolver==1.3.0
MarkupSafe==1.1.1
matplotlib==3.3.2
mistune==0.8.4
nbconvert==5.6.1
nbformat==5.0.7
notebook==6.1.3
numpy==1.19.2
packaging==20.4
pandocfilters==1.4.2
parso==0.7.1
pickleshare==0.7.5
Pillow==8.0.1
prometheus-client==0.8.0
prompt-toolkit==3.0.7
pycparser==2.20
Pygments==2.6.1
pyparsing==2.4.7
pyrsistent==0.16.0
python-dateutil==2.8.1
pytz==2020.1
pywin32==228
pywinpty==0.5.7
pyzmq==19.0.2
qtconsole==4.7.7
QtPy==1.9.0
Send2Trash==1.5.0
six==1.15.0
terminado==0.8.3
testpath==0.4.4
tornado==6.0.4
traitlets==4.3.3
virtualenv==20.0.31
virtualenvwrapper-win==1.2.6
wcwidth==0.2.5
webencodings==0.5.1
widgetsnbextension==3.5.1
zipp==3.1.0
zope.interface==5.1.2
Note: you may need to restart the kernel to use updated packages.
import matplotlib
ImportError Traceback (most recent call last)
in
----> 1 import matplotlib
c:\users\179\appdata\local\programs\python\python36\lib\site-packages\matplotlib\__init__.py in
172
173
--> 174 _check_versions()
175
176
c:\users\179\appdata\local\programs\python\python36\lib\site-packages\matplotlib\__init__.py in _check_versions()
166 ("pyparsing", "2.0.1"),
167 ]:
--> 168 module = importlib.import_module(modname)
169 if LooseVersion(module.__version__) < minver:
170 raise ImportError("Matplotlib requires {}>={}; you have {}"
c:\users\179\appdata\local\programs\python\python36\lib\importlib\__init__.py in import_module(name, package)
124 break
125 level += 1
--> 126 return _bootstrap._gcd_import(name[level:], package, level)
127
128
ImportError: DLL load failed: Не найден указанный модуль.
pip install matplotlib
Requirement already satisfied: matplotlib in c:\users\179\appdata\local\programs\python\python36\lib\site-packages (3.3.2)Note: you may need to restart the kernel to use updated packages.
Requirement already satisfied: certifi>=2020.06.20 in c:\users\179\appdata\local\programs\python\python36\lib\site-packages (from matplotlib) (2020.6.20)
Requirement already satisfied: numpy>=1.15 in c:\users\179\appdata\local\programs\python\python36\lib\site-packages (from matplotlib) (1.19.2)
Requirement already satisfied: pyparsing!=2.0.4,!=2.1.2,!=2.1.6,>=2.0.3 in c:\users\179\appdata\local\programs\python\python36\lib\site-packages (from matplotlib) (2.4.7)
Requirement already satisfied: kiwisolver>=1.0.1 in c:\users\179\appdata\local\programs\python\python36\lib\site-packages (from matplotlib) (1.3.0)
Requirement already satisfied: cycler>=0.10 in c:\users\179\appdata\local\programs\python\python36\lib\site-packages (from matplotlib) (0.10.0)
Requirement already satisfied: pillow>=6.2.0 in c:\users\179\appdata\local\programs\python\python36\lib\site-packages (from matplotlib) (8.0.1)
Requirement already satisfied: python-dateutil>=2.1 in c:\users\179\appdata\local\programs\python\python36\lib\site-packages (from matplotlib) (2.8.1)
Requirement already satisfied: six in c:\users\179\appdata\local\programs\python\python36\lib\site-packages (from cycler>=0.10->matplotlib) (1.15.0)
def logger(filename):
def decorator(func):
def wrapped(*args, **kwargs):
result = func(*args, **kwargs)
with open(filename, 'w') as f:
f.write(str(result))
return result
return wrapped
return decorator
@logger('new_log.txt')
def summator(num_list):
return sum(num_list)
# без синтаксического сахара:
# summator = logger('log.txt')(summator)
summator([1, 2, 3, 4, 5, 6])
with open('new_log.txt', 'r') as f:
print(f.read())