Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/337.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 为什么numpy给了“什么?”;分段故障“;在导入和pydoc时?_Python_Numpy_Segmentation Fault_Pydoc - Fatal编程技术网

Python 为什么numpy给了“什么?”;分段故障“;在导入和pydoc时?

Python 为什么numpy给了“什么?”;分段故障“;在导入和pydoc时?,python,numpy,segmentation-fault,pydoc,Python,Numpy,Segmentation Fault,Pydoc,我已安装并按以下方式调用numpy库。但为什么它会给赛格一个错误呢? 如何克服这个问题 [pdubois@mymachine Tools]$ pip install numpy Requirement already satisfied (use --upgrade to upgrade): numpy in /misc/u21/pdubois/.python2.7.6/lib/python2.7/site-packages/numpy-1.9.0.dev_688b243-py2.7-linu

我已安装并按以下方式调用
numpy
库。但为什么它会给赛格一个错误呢? 如何克服这个问题

[pdubois@mymachine Tools]$ pip install numpy 
Requirement already satisfied (use --upgrade to upgrade): numpy in /misc/u21/pdubois/.python2.7.6/lib/python2.7/site-packages/numpy-1.9.0.dev_688b243-py2.7-linux-x86_64.egg
Cleaning up..
也可使用
easy\u安装

[pdubois@mymachine ~]$ easy_install-2.7.6 numpy 
Searching for numpy
Best match: numpy 1.9.0.dev-688b243
Processing numpy-1.9.0.dev_688b243-py2.7-linux-x86_64.egg
numpy 1.9.0.dev-688b243 is already the active version in easy-install.pth
Installing f2py script to /u21/pdubois/.python2.7.6/bin

Using /misc/u21/pdubois/.python2.7.6/lib/python2.7/site-packages/numpy-1.9.0.dev_688b243-py2.7-linux-x86_64.egg
Processing dependencies for numpy
Finished processing dependencies for numpy
它给了我这个错误:

[pdubois@mymachine Tools]$ python 
Python 2.7.6 (default, Feb  4 2014, 10:19:53) 
[GCC 4.1.2 20080704 (Red Hat 4.1.2-54)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy 
Segmentation fault
类似地,当我使用pydoc调用它时:

[pdubois@mymachine Tools]$ pydoc numpy 
Segmentation fault

在文件pydoc.py中,必须更改默认函数:

def pipepager(text, cmd):
    """Page through text by feeding it to another program."""
    pipe = os.popen(cmd, 'w')
    try:
        pipe.write(text)
        pipe.close()
    except IOError:
        pass # Ignore broken pipes caused by quitting the pager program.
致:

显然,当您更改
os.popen()


查看更多信息。

是否尝试安装1.8而不是1.9?1.9仍然是测试版。通常使用numpy 1.8应该可以工作

我建议您尝试使用和在环境中安装numpy来设置python虚拟环境,并查看问题是否被复制

在系统默认的python安装环境下安装时,会出现numpy中断的问题。 对此有一个讨论。你可以参考它来进一步了解这个问题

此外,numpy依赖项库也存在导致此问题的问题。
讨论中有人指出,ATLAS库可能是一个问题,在没有ATLAS的情况下安装numpy解决了这个问题。

我在导入由GCC 4.1.2编译的numpy 1.9.0时也遇到了同样的问题。它是通过使用GCC 4.4.7解决的。

如何使用
pip
easy\u install
指定numpy 1.8?@pdubois-hmm,这会是64位对32位的问题吗?(如果不是这样的话,那我就灵感不足了)你在用哪个linux发行版?
def pipepager(text, cmd):
    """Page through text by feeding it to another program."""
    import subprocess
    pipe = subprocess.Popen(cmd, stdin=subprocess.PIPE, shell=True).stdin
    try:
        pipe.write(text)
        pipe.close()
    except IOError:
        pass # Ignore broken pipes caused by quitting the pager program.