Берём простейший тест, предлагаемый NumPy (wiki-описание):Olej писал(а): ... ну а затем ещё и испытать.
Код: Выделить всё
x = linspace( 0, 2*pi, 100 )
y = sin( x )
plot( x, y, 'ro-' )
А для приведения его в соответствие, хотя бы синтаксическое, нужно переписать, например:
Код: Выделить всё
#!/usr/bin/python
# -*- coding: utf-8 -*-
import sys
import os
import numpy as np
from math import *
from pplot import plot
def main():
x = np.linspace( 0, 2 * pi, 100 )
y = np.sin( x ) # numpy.sin() но не math.sin() !
plot( x, y, 'ro-' )
if __name__ == '__main__':
try:
main()
except Exception as exc:
sys.stderr.write( u"{}\n{}\n".format( -1, exc ) )
sys.exit( 1 )
Код: Выделить всё
olej@nvidia ~/2017_WORK/own.WORK/python $ sudo python -m pip install pplot
[sudo] пароль для olej:
The directory '/home/olej/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/home/olej/.cache/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Collecting pplot
Downloading pplot-1.0.4-py27-none-any.whl (59kB)
100% |████████████████████████████████| 61kB 555kB/s
Collecting decorator>=3.4.2 (from pplot)
Downloading decorator-4.0.11-py2.py3-none-any.whl
Collecting funcsigs>=0.4 (from pplot)
Downloading funcsigs-1.0.2-py2.py3-none-any.whl
Requirement already satisfied: six>=1.4.0 in /usr/lib/python2.7/dist-packages (from pplot)
Collecting pycontracts!=1.7.7,>=1.7.2 (from pplot)
Downloading PyContracts-1.7.15.tar.gz (89kB)
100% |████████████████████████████████| 92kB 1.8MB/s
Could not import setuptools which is required to install from a source distribution.
Please install setuptools.
Код: Выделить всё
olej@nvidia ~/2017_WORK/own.WORK/python $ sudo python -m pip install setuptools
The directory '/home/olej/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/home/olej/.cache/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Collecting setuptools
Downloading setuptools-36.2.0-py2.py3-none-any.whl (477kB)
100% |████████████████████████████████| 481kB 1.5MB/s
Installing collected packages: setuptools
Successfully installed setuptools-36.2.0
Код: Выделить всё
olej@nvidia ~/2017_WORK/own.WORK/python $ sudo python -m pip install pplot
The directory '/home/olej/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/home/olej/.cache/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Collecting pplot
Downloading pplot-1.0.4-py27-none-any.whl (59kB)
100% |████████████████████████████████| 61kB 594kB/s
Collecting decorator>=3.4.2 (from pplot)
Downloading decorator-4.0.11-py2.py3-none-any.whl
Collecting funcsigs>=0.4 (from pplot)
Downloading funcsigs-1.0.2-py2.py3-none-any.whl
Requirement already satisfied: six>=1.4.0 in /usr/lib/python2.7/dist-packages (from pplot)
Collecting pycontracts!=1.7.7,>=1.7.2 (from pplot)
Downloading PyContracts-1.7.15.tar.gz (89kB)
100% |████████████████████████████████| 92kB 1.8MB/s
Collecting matplotlib>=1.4.1 (from pplot)
Downloading matplotlib-2.0.2-cp27-cp27mu-manylinux1_x86_64.whl (14.5MB)
100% |████████████████████████████████| 14.5MB 74kB/s
Collecting pmisc>=1.2.2 (from pplot)
Downloading pmisc-1.2.2-py27-none-any.whl
Collecting scipy>=0.13.3 (from pplot)
Downloading scipy-0.19.1-cp27-cp27mu-manylinux1_x86_64.whl (45.0MB)
100% |████████████████████████████████| 45.0MB 22kB/s
Requirement already satisfied: pillow>=2.6.1 in /usr/lib/python2.7/dist-packages (from pplot)
Collecting pexdoc>=1.0.9 (from pplot)
Downloading pexdoc-1.0.9-py27-none-any.whl (52kB)
100% |████████████████████████████████| 61kB 2.7MB/s
Requirement already satisfied: numpy>=1.8.2 in /usr/local/lib/python2.7/dist-packages (from pplot)
Collecting peng>=1.0.6 (from pplot)
Downloading peng-1.0.6-py27-none-any.whl (50kB)
100% |████████████████████████████████| 51kB 2.6MB/s
Collecting pcsv>=1.0.5 (from pplot)
Downloading pcsv-1.0.5-py27-none-any.whl
Collecting pyparsing (from pycontracts!=1.7.7,>=1.7.2->pplot)
Downloading pyparsing-2.2.0-py2.py3-none-any.whl (56kB)
100% |████████████████████████████████| 61kB 3.2MB/s
Collecting cycler>=0.10 (from matplotlib>=1.4.1->pplot)
Downloading cycler-0.10.0-py2.py3-none-any.whl
Collecting python-dateutil (from matplotlib>=1.4.1->pplot)
Downloading python_dateutil-2.6.1-py2.py3-none-any.whl (194kB)
100% |████████████████████████████████| 194kB 2.1MB/s
Collecting functools32 (from matplotlib>=1.4.1->pplot)
Downloading functools32-3.2.3-2.zip
Collecting pytz (from matplotlib>=1.4.1->pplot)
Downloading pytz-2017.2-py2.py3-none-any.whl (484kB)
100% |████████████████████████████████| 491kB 1.6MB/s
Collecting subprocess32 (from matplotlib>=1.4.1->pplot)
Downloading subprocess32-3.2.7.tar.gz (54kB)
100% |████████████████████████████████| 61kB 3.4MB/s
Collecting pytest>=2.7.0 (from pmisc>=1.2.2->pplot)
Downloading pytest-3.1.3-py2.py3-none-any.whl (181kB)
100% |████████████████████████████████| 184kB 2.4MB/s
Collecting ptrie>=1.0.6 (from pexdoc>=1.0.9->pplot)
Downloading ptrie-1.0.6-py27-none-any.whl
Requirement already satisfied: setuptools in /usr/local/lib/python2.7/dist-packages (from pytest>=2.7.0->pmisc>=1.2.2->pplot)
Collecting py>=1.4.33 (from pytest>=2.7.0->pmisc>=1.2.2->pplot)
Downloading py-1.4.34-py2.py3-none-any.whl (84kB)
100% |████████████████████████████████| 92kB 3.0MB/s
Installing collected packages: decorator, funcsigs, pyparsing, pycontracts, cycler, python-dateutil, functools32, pytz, subprocess32, matplotlib, py, pytest, pmisc, scipy, ptrie, pexdoc, peng, pcsv, pplot
Running setup.py install for pycontracts ... done
Running setup.py install for functools32 ... done
Running setup.py install for subprocess32 ... done
Successfully installed cycler-0.10.0 decorator-4.0.11 funcsigs-1.0.2 functools32-3.2.3.post2 matplotlib-2.0.2 pcsv-1.0.5 peng-1.0.6 pexdoc-1.0.9 pmisc-1.2.2 pplot-1.0.4 ptrie-1.0.6 py-1.4.34 pycontracts-1.7.15 pyparsing-2.2.0 pytest-3.1.3 python-dateutil-2.6.1 pytz-2017.2 scipy-0.19.1 subprocess32-3.2.7
Код: Выделить всё
olej@nvidia ~/2017_WORK/own.WORK/python $ python gsin.py
Traceback (most recent call last):
File "gsin.py", line 8, in <module>
from pplot import plot
File "/usr/local/lib/python2.7/dist-packages/pplot/__init__.py", line 18, in <module>
from .basic_source import BasicSource
File "/usr/local/lib/python2.7/dist-packages/pplot/basic_source.py", line 13, in <module>
from .functions import _C, _SEL, DataSource
File "/usr/local/lib/python2.7/dist-packages/pplot/functions.py", line 15, in <module>
import matplotlib.pyplot as plt
File "/usr/local/lib/python2.7/dist-packages/matplotlib/pyplot.py", line 115, in <module>
_backend_mod, new_figure_manager, draw_if_interactive, _show = pylab_setup()
File "/usr/local/lib/python2.7/dist-packages/matplotlib/backends/__init__.py", line 32, in pylab_setup
globals(),locals(),[backend_name],0)
File "/usr/local/lib/python2.7/dist-packages/matplotlib/backends/backend_tkagg.py", line 6, in <module>
from six.moves import tkinter as Tk
File "/usr/lib/python2.7/dist-packages/six.py", line 203, in load_module
mod = mod._resolve()
File "/usr/lib/python2.7/dist-packages/six.py", line 115, in _resolve
return _import_module(self.mod)
File "/usr/lib/python2.7/dist-packages/six.py", line 82, in _import_module
__import__(name)
File "/usr/lib/python2.7/lib-tk/Tkinter.py", line 42, in <module>
raise ImportError, str(msg) + ', please install the python-tk package'
ImportError: No module named _tkinter, please install the python-tk package