Installed the NumPy library, ran the elementary code from the tutorial, for example
import numpy as np a = np.array([0, 1, 2, 3, 4, 5]) print(a.ndim) print(a.shape) everything worked correctly after trying to run
import timeit normal_py_sec = timeit.timeit('sum(x*x for x in range(1000))', number=10000) naive_np_sec = timeit.timeit( 'sum(na*na)', setup="import numpy as np; na=np.arange(1000)", number=10000) good_np_sec = timeit.timeit( 'na.dot(na)', setup="import numpy as np; na=np.arange(1000)", number=10000) print("Normal Python: %f sec" % normal_py_sec) print("Naive NumPy: %f sec" % naive_np_sec) gave an error. Now, every run of any code using NumPy crashes on the very first line of import, yielding
Traceback (most recent call last): File "/home/oksana/PycharmProjects/machine_learning/ch_1.py", line 1, in <module> import numpy as np File "/usr/lib64/python3.4/site-packages/numpy/__init__.py", line 142, in <module> from . import add_newdocs File "/usr/lib64/python3.4/site-packages/numpy/add_newdocs.py", line 13, in <module> from numpy.lib import add_newdoc File "/usr/lib64/python3.4/site-packages/numpy/lib/__init__.py", line 8, in <module> from .type_check import * File "/usr/lib64/python3.4/site-packages/numpy/lib/type_check.py", line 11, in <module> import numpy.core.numeric as _nx File "/usr/lib64/python3.4/site-packages/numpy/core/__init__.py", line 58, in <module> from numpy.testing.nosetester import _numpy_tester File "/usr/lib64/python3.4/site-packages/numpy/testing/__init__.py", line 10, in <module> from unittest import TestCase File "/usr/lib64/python3.4/unittest/__init__.py", line 59, in <module> from .case import (TestCase, FunctionTestCase, SkipTest, skip, skipIf, File "/usr/lib64/python3.4/unittest/case.py", line 7, in <module> import logging File "/usr/lib64/python3.4/logging/__init__.py", line 85, in <module> _startTime = time.time() AttributeError: 'module' object has no attribute 'time' Reinstalling via pip3 and yum did not help. Checked in Python 2, there are no problems. The newcomer to Python itself, I will be very grateful for the help.
python3.4- are you sure that everything is in order with the environment (UNIX environment)? - MaxUtime.py... - MaxU