我正在运行默认附带的 Ubuntu 12.04 NumPy 1.6.0
(我实际上已经Python 2.7.3
安装了)。由于这个问题polyfit() got an unexpected keyword argument 'w'的答案,我需要升级它。
我从这里.tar.gz
下载了该版本的包,解压缩,移到文件夹中并运行命令:1.8.0
python setup.py build --fcompiler=gnu95
python setup.py install --user
如用户指南和此问题中所述:在 Ubuntu 上构建 NumPy 1.7.1。
这导致NumPy
不再加载Spyder
,现在显示错误:
Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/spyderlib/scientific_startup.py", line 16, in <module>
from pylab import * #analysis:ignore
File "/usr/local/lib/python2.7/dist-packages/pylab.py", line 1, in <module>
from matplotlib.pylab import *
File "/usr/local/lib/python2.7/dist-packages/matplotlib/__init__.py", line 165, in <module>
from matplotlib.rcsetup import (defaultParams,
File "/usr/local/lib/python2.7/dist-packages/matplotlib/rcsetup.py", line 20, in <module>
from matplotlib.colors import is_color_like
File "/usr/local/lib/python2.7/dist-packages/matplotlib/colors.py", line 52, in <module>
import numpy as np
File "/home/gabriel/.local/lib/python2.7/site-packages/numpy/__init__.py", line 153, in <module>
from . import add_newdocs
File "/home/gabriel/.local/lib/python2.7/site-packages/numpy/add_newdocs.py", line 13, in <module>
from numpy.lib import add_newdoc
File "/home/gabriel/.local/lib/python2.7/site-packages/numpy/lib/__init__.py", line 8, in <module>
from .type_check import *
File "/home/gabriel/.local/lib/python2.7/site-packages/numpy/lib/type_check.py", line 11, in <module>
import numpy.core.numeric as _nx
File "/home/gabriel/.local/lib/python2.7/site-packages/numpy/core/__init__.py", line 6, in <module>
from . import multiarray
ImportError: /home/gabriel/.local/lib/python2.7/site-packages/numpy/core/multiarray.so: undefined symbol: PyUnicodeUCS2_FromUnicode
在加载它。当我尝试使用 version 时发生了同样的情况1.7.1
。
我尝试删除numpy
:
sudo apt-get remove python-numpy
这也删除了matplotlib
和scipy
。所以我尝试重新安装它们:
sudo apt-get install python-numpy python-scipy python-matplotlib
但这失败并出现错误:
from sre_constants import *
File "/usr/local/lib/python2.7/sre_constants.py", line 18, in <module>
from _sre import MAXREPEAT
ImportError: cannot import name MAXREPEAT
现在我没有运行 python,我什至不知道如何回到以前的稳定版本。所以问题是:我可以在我的系统中安装至少一个版本吗?1.7.1
如果不能,我该如何回到工作1.6.0
版本?谢谢。