安装完anaconda遇到如下问题:
dfangwang@dfangwang-B85M-D3V-A:~$ python
Python 2.7.15 |Anaconda, Inc.| (default, Dec 14 2018, 19:04:19)
[GCC 7.3.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/dfangwang/Documents/yes/lib/python2.7/site-packages/numpy/__init__.py", line 142, in <module>
from . import core
File "/home/dfangwang/Documents/yes/lib/python2.7/site-packages/numpy/core/__init__.py", line 59, in <module>
from . import numeric
File "/home/dfangwang/Documents/yes/lib/python2.7/site-packages/numpy/core/numeric.py", line 3093, in <module>
from . import fromnumeric
File "/home/dfangwang/Documents/yes/lib/python2.7/site-packages/numpy/core/fromnumeric.py", line 17, in <module>
from . import _methods
File "/home/dfangwang/Documents/yes/lib/python2.7/site-packages/numpy/core/_methods.py", line 158, in <module>
_NDARRAY_ARRAY_FUNCTION = mu.ndarray.__array_function__
AttributeError: type object 'numpy.ndarray' has no attribute '__array_function__'
解决方案:
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple numpy==1.15.4
参考:
http://www.codeleading.com/article/2235321030/;jsessionid=7802F1C6EEA808CB366C649AD1BBDD79
https://github.com/numpy/numpy/issues/12736
下面方案不可行: