ubuntu - GDAL 不会安装到 GitHub Actions Ubuntu venv
问题描述
我的 .yml 代码如下所示,用于测试为 Git 上的存储库创建的每个拉取请求。
name: Python Linux application
on:
pull_request:
branches: [ '**' ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.9
uses: actions/setup-python@v2
with:
python-version: 3.9
- name: Install dependencies
run: |
python -m pip install --upgrade pip
sudo apt-get install libproj-dev proj-data proj-bin
sudo apt-get install libgeos-dev
sudo apt-get install gdal-bin libgdal-dev libgdal-doc
pip install wheel
pip install flake8 pytest Cython numpy proj geos GDAL==3.2.3
if [ -f requirements-linux.txt ]; then pip install -r requirements-linux.txt; fi
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Test with pytest
run: |
pytest
经过数千 (11390) 行错误代码后,这是最终错误:
error: command '/usr/bin/gcc' failed with exit code 1
----------------------------------------
ERROR: Command errored out with exit status 1: /opt/hostedtoolcache/Python/3.9.5/x64/bin/python -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-rkrb3fqi/gdal_c6b10766da894ef6b4738e8ab6e2acd7/setup.py'"'"'; __file__='"'"'/tmp/pip-install-rkrb3fqi/gdal_c6b10766da894ef6b4738e8ab6e2acd7/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-9qjem06l/install-record.txt --single-version-externally-managed --compile --install-headers /opt/hostedtoolcache/Python/3.9.5/x64/include/python3.9/GDAL Check the logs for full command output.
我已经尝试安装所有我能找到的与 GDAL 相关的标头,但似乎没有任何效果。
解决方案
修复了它,对于那些处于类似情况的人来说,这是这个问题的答案:
sudo apt-add-repository ppa:ubuntugis/ubuntugis-unstable
sudo apt-get update
sudo apt-get install gdal-bin libgdal-dev
pip install GDAL==3.2.3
推荐阅读
- c - 将一个字符串复制到另一个
- javascript - 尝试使用 javascript 获取音频当前和总时间
- identity - 将 MSAL 与非 Microsoft 身份提供程序一起使用
- c++ - 如何使用 gmock 在具体类中模拟非虚拟方法?
- css - Bootstrap 5 导航栏和固定顶部位置
- swift - 如何为表中的 TableColumn 赋予默认值
- mysql - mysql 驱动程序未在 venv 中的 flask_sqlalchemy python3 上加载 没有名为“MySQLdb”的模块
- xpath - Xpath:根据没有特定属性的后代选择元素
- angular - 动态更改角度材质表单字段外观
- php - laravel eloquent 用 id 数组更新 hasmany