我正在尝试使用 python 安装 GDAL。但它失败并出现错误。
我使用的命令是pip install GDAL.
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -fPIC -I../../port -I../../gcore -I../../alg -I../../ogr/ -I../../ogr/ogrsf_frmts -I../../gnm -I../../apps -I/usr/include/python2.7 -I/usr/local/lib/python2.7/dist-packages/numpy/core/include -I/usr/include -c extensions/gdal_wrap.cpp -o build/temp.linux-x86_64-2.7/extensions/gdal_wrap.o -std=c++11 -I/usr/include/gdal
extensions/gdal_wrap.cpp:3177:27: fatal error: cpl_vsi_error.h: No such file or directory
compilation terminated.
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
Run Code Online (Sandbox Code Playgroud)
和
----------------------------------------
Failed building wheel for GDAL
Running setup.py clean for GDAL
Failed to build GDAL
Installing collected packages: GDAL
Running …Run Code Online (Sandbox Code Playgroud) 我正在尝试实现类似的东西
if np.max(subgrid) == np.min(subgrid):
middle_middle = cur_subgrid + 1
else:
middle_middle = cur_subgrid
Run Code Online (Sandbox Code Playgroud)
由于条件只能在运行时确定,我使用 Keras 语法如下
middle_middle = K.switch(K.max(subgrid) == K.min(subgrid), lambda: tf.add(cur_subgrid,1), lambda: cur_subgrid)
Run Code Online (Sandbox Code Playgroud)
但我收到此错误:
<ipython-input-112-0504ce070e71> in col_loop(j, gray_map, mask_A)
56
57
---> 58 middle_middle = K.switch(K.max(subgrid) == K.min(subgrid), lambda: tf.add(cur_subgrid,1), lambda: cur_subgrid)
59
60 print ('ml',middle_left.shape)
/nfs/isicvlnas01/share/anaconda3/lib/python3.5/site-packages/keras/backend/tensorflow_backend.py in switch(condition, then_expression, else_expression) 2561 The selected tensor. 2562 """
-> 2563 if condition.dtype != tf.bool: 2564 condition = tf.cast(condition, 'bool') 2565 if not callable(then_expression):
AttributeError: 'bool' object has no …Run Code Online (Sandbox Code Playgroud)