Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/python-2.7/5.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 2.7 python 2.7+;RHEL 6.5+;Shapely-1.4.4:记忆错误_Python 2.7_Geos_Rhel6 - Fatal编程技术网

Python 2.7 python 2.7+;RHEL 6.5+;Shapely-1.4.4:记忆错误

Python 2.7 python 2.7+;RHEL 6.5+;Shapely-1.4.4:记忆错误,python-2.7,geos,rhel6,Python 2.7,Geos,Rhel6,我在RHEL 6.5上的两次部署中都遇到了这个问题。无法通过谷歌搜索找到任何答案 基本安装包 (nout)$ sudo rpm -qa | grep geos geos-devel-3.3.2-1.el6.x86_64 geos-3.3.2-1.el6.x86_64 geos-python-3.3.2-1.el6.x86_64 匀称安装 (nout)$ easy_install -Z Shapely-1.4.4.tar.gz Processing Shapely-1.4.4.tar.gz W

我在RHEL 6.5上的两次部署中都遇到了这个问题。无法通过谷歌搜索找到任何答案

基本安装包

(nout)$ sudo rpm -qa | grep geos
geos-devel-3.3.2-1.el6.x86_64
geos-3.3.2-1.el6.x86_64
geos-python-3.3.2-1.el6.x86_64
匀称安装

(nout)$ easy_install -Z Shapely-1.4.4.tar.gz 
Processing Shapely-1.4.4.tar.gz
Writing /tmp/easy_install-iLylTY/Shapely-1.4.4/setup.cfg
Running Shapely-1.4.4/setup.py -q bdist_egg --dist-dir /tmp/easy_install-iLylTY/Shapely-1.4.4/egg-dist-tmp-xFmed4
Numpy or Cython not available, shapely.vectorized submodule not being built.
shapely/speedups/_speedups.c: In function ‘__pyx_pf_7shapely_8speedups_9_speedups_2geos_linestring_from_py’:
shapely/speedups/_speedups.c:1603: warning: assignment discards qualifiers from pointer target type
shapely/speedups/_speedups.c:2087: warning: assignment discards qualifiers from pointer target type
shapely/speedups/_speedups.c:2553: warning: assignment discards qualifiers from pointer target type
shapely/speedups/_speedups.c: In function ‘__pyx_pf_7shapely_8speedups_9_speedups_4geos_linearring_from_py’:
shapely/speedups/_speedups.c:3118: warning: assignment discards qualifiers from pointer target type
shapely/speedups/_speedups.c:3127: warning: pointer targets in passing argument 3 of ‘GEOSCoordSeq_getSize_r’ differ in signedness
/usr/include/geos_c.h:321: note: expected ‘unsigned int *’ but argument is of type ‘int *’
shapely/speedups/_speedups.c:3614: warning: assignment discards qualifiers from pointer target type
shapely/speedups/_speedups.c:4158: warning: assignment discards qualifiers from pointer target type
shapely/speedups/_speedups.c: At top level:
shapely/speedups/_speedups.c:924: warning: ‘__pyx_f_7shapely_8speedups_9_speedups_get_geos_context_handle’ defined but not used
shapely/speedups/_speedups.c:1010: warning: ‘__pyx_f_7shapely_8speedups_9_speedups_geos_from_prepared’ defined but not used
zip_safe flag not set; analyzing archive contents...
shapely.geos: module references __file__
Adding Shapely 1.4.4 to easy-install.pth file
Python Shell

(nout)$ python
Python 2.7.8 (default, Sep 12 2014, 14:39:38) 
[GCC 4.4.7 20120313 (Red Hat 4.4.7-4)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from shapely.geometry import Polygon, Point
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/omd/nocout/nout/lib/python2.7/site-packages/Shapely-1.4.4-py2.7-linux-x86_64.egg/shapely/geometry/__init__.py", line 4, in <module>
    from .base import CAP_STYLE, JOIN_STYLE
  File "/omd/nocout/nout/lib/python2.7/site-packages/Shapely-1.4.4-py2.7-linux-x86_64.egg/shapely/geometry/base.py", line 9, in <module>
    from shapely.coords import CoordinateSequence
  File "/omd/nocout/nout/lib/python2.7/site-packages/Shapely-1.4.4-py2.7-linux-x86_64.egg/shapely/coords.py", line 8, in <module>
    from shapely.geos import lgeos
  File "/omd/nocout/nout/lib/python2.7/site-packages/Shapely-1.4.4-py2.7-linux-x86_64.egg/shapely/geos.py", line 194, in <module>
    error_h = EXCEPTION_HANDLER_FUNCTYPE(error_handler)
MemoryError
>>> from shapely.ops import transform
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/omd/nocout/nout/lib/python2.7/site-packages/Shapely-1.4.4-py2.7-linux-x86_64.egg/shapely/ops.py", line 13, in <module>
    from shapely.geos import lgeos
  File "/omd/nocout/nout/lib/python2.7/site-packages/Shapely-1.4.4-py2.7-linux-x86_64.egg/shapely/geos.py", line 194, in <module>
    error_h = EXCEPTION_HANDLER_FUNCTYPE(error_handler)
MemoryError
(nout)$python
Python 2.7.8(默认,2014年9月12日,14:39:38)
[GCC 4.4.7 20120313(Red Hat 4.4.7-4)]关于linux2
有关详细信息,请键入“帮助”、“版权”、“信用证”或“许可证”。
>>>从shapely.geometry导入多边形,点
回溯(最近一次呼叫最后一次):
文件“”,第1行,在
文件“/omd/nocout/nout/lib/python2.7/site packages/Shapely-1.4.4-py2.7-linux-x86_64.egg/Shapely/geometry/u_init__.py”,第4行,in
从.base导入CAP\u样式,连接\u样式
文件“/omd/nocout/nout/lib/python2.7/site packages/Shapely-1.4.4-py2.7-linux-x86_64.egg/Shapely/geometry/base.py”,第9行,in
从shapely.coords导入坐标序列
文件“/omd/nocout/nout/lib/python2.7/site packages/Shapely-1.4.4-py2.7-linux-x86_64.egg/Shapely/coords.py”,第8行,在
从shapely.geos导入lgeos
文件“/omd/nocout/nout/lib/python2.7/site packages/Shapely-1.4.4-py2.7-linux-x86_64.egg/Shapely/geos.py”,第194行,in
error\u h=异常处理程序\u FUNCTYPE(error\u HANDLER)
记忆者
Python Shell

(nout)$ python
Python 2.7.8 (default, Sep 12 2014, 14:39:38) 
[GCC 4.4.7 20120313 (Red Hat 4.4.7-4)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from shapely.geometry import Polygon, Point
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/omd/nocout/nout/lib/python2.7/site-packages/Shapely-1.4.4-py2.7-linux-x86_64.egg/shapely/geometry/__init__.py", line 4, in <module>
    from .base import CAP_STYLE, JOIN_STYLE
  File "/omd/nocout/nout/lib/python2.7/site-packages/Shapely-1.4.4-py2.7-linux-x86_64.egg/shapely/geometry/base.py", line 9, in <module>
    from shapely.coords import CoordinateSequence
  File "/omd/nocout/nout/lib/python2.7/site-packages/Shapely-1.4.4-py2.7-linux-x86_64.egg/shapely/coords.py", line 8, in <module>
    from shapely.geos import lgeos
  File "/omd/nocout/nout/lib/python2.7/site-packages/Shapely-1.4.4-py2.7-linux-x86_64.egg/shapely/geos.py", line 194, in <module>
    error_h = EXCEPTION_HANDLER_FUNCTYPE(error_handler)
MemoryError
>>> from shapely.ops import transform
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/omd/nocout/nout/lib/python2.7/site-packages/Shapely-1.4.4-py2.7-linux-x86_64.egg/shapely/ops.py", line 13, in <module>
    from shapely.geos import lgeos
  File "/omd/nocout/nout/lib/python2.7/site-packages/Shapely-1.4.4-py2.7-linux-x86_64.egg/shapely/geos.py", line 194, in <module>
    error_h = EXCEPTION_HANDLER_FUNCTYPE(error_handler)
MemoryError
>>来自shapely.ops导入转换
回溯(最近一次呼叫最后一次):
文件“”,第1行,在
文件“/omd/nocout/nout/lib/python2.7/site packages/Shapely-1.4.4-py2.7-linux-x86_64.egg/Shapely/ops.py”,第13行,在
从shapely.geos导入lgeos
文件“/omd/nocout/nout/lib/python2.7/site packages/Shapely-1.4.4-py2.7-linux-x86_64.egg/Shapely/geos.py”,第194行,in
error\u h=异常处理程序\u FUNCTYPE(error\u HANDLER)
记忆者
调用
导入时
内存错误


我无法理解原因。

对于
RHEL
+
启用selinux
+
/tmp作为noexec
,任何试图在
/tmp
中访问和执行的模块都会生成内存错误

在我的例子中,
/tmp
noexec
,selinux是强制执行的

/tmp
默认为
默认值、noexec、nosuid、nodev

我设置:查看:

但问题依然存在,如果我正确理解的话,这是因为:

因此上的
httpd\u tmp\u exec-->选项对我没有用处

我查看python库文件,搜索
/tmp
声明,发现
tempfile.py行147
def\u candidate\u tempdir\u list()

在这里,我看到如果有envnames
TMPDIR
TEMP
TMP
,python将拾取TEMP位置

设置哪个变量?为此,我进入了
libffi
源代码,
libffi-3.0.6
。文件:
src/closures.c
第290行
open_temp_exec_file_env,“TMPDIR”,0

TMPDIR
是要设置的候选项

我继续安装
/opt/app/tmp
,设置
导出TMPDIR=/opt/app/tmp

在我使用
pythonidle
之前,所有这些都可以正常工作,当我继续部署
nginx+uwsgi
时,我也遇到了同样的错误。现在我不知道为什么会发生这种情况,我想一定是执行问题。因此,我首先重新安装了
uwsgi
,然后修改了
nginx.conf
/location
,查看:set:
uwsgi\u temp\u路径

我重新启动了所有的服务,nginx,uwsgi。我试过了。成功了

我还首次尝试了:(安全)黑客:

结果令我失望