- Phần 1: Một số lưu ý để tránh gặp lỗi khi cài đặt
- Phần 2: Khắc phục một số lỗi thường gặp.
*Phần 1: Một số lưu ý để tranh gặp lỗi khi cài đặt
- Để gọi các hàm python thực thi thư viện GDAL, cần phải cài đặt gói binary GDAL và install GDAL python bằng lệnh pip install gdal
- Gói thư viện binary GDAL phải cùng phiên bản 32/64bit với Python.
- Các path phải được include vào biến path env và settings của django
- Tiến trình chạy python phải có quyền truy cập vào dll của GDAL
*Phần 2: Khắc phục một số lỗi thường gặp
(1) Không tìm thấy module gdal
Cài đặt gdal bằng lệnh: pip install gdal -> bước này thường xảy ra lỗi dây chuyền (2)
(2) Error: Unable to find vcvarsall.bat
Dựa vào phiên bản Python để xác định các bản cài đặt bắt buộc sau đây
https://blogs.msdn.microsoft.com/pythonengineering/2016/04/11/unable-to-find-vcvarsall-bat/
Python Version | You will need |
---|---|
3.5 and later | Update: Install Visual Studio 2017, select the Python development workload and the Native development tools option. Visual C++ Build Tools 2015 or Visual Studio 2015 |
3.3 and 3.4 | Windows SDK for Windows 7 and .NET 4.0 (Alternatively, Visual Studio 2010 if you have access to it) |
2.6 to 3.2 | Microsoft Visual C++ Compiler for Python 2.7 |
Sau khi cài đặt các gói yêu cầu, thiết lập cấu hình cho biết PATH đến thư mục chứa vcvarsall.bat mặc định sẽ là thư mục "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC" --> sau khi khắc phục lôi này thông thường sẽ dẫn đến lỗi (3)
(3) Fatal error C1083: Cannot open include file: 'cpl_port.h': No such file or directory
https://www.lfd.uci.edu/~gohlke/pythonlibs/#gdal
OSerror not valid 32bit
Not found spec module
Import gdal202,....
Required vc 14
Not found spec module
Import gdal202,....
Required vc 14
chào bạn mình cũng đang mắc phải lỗi này, không giải quyết được bạn ạ
Trả lờiXóaC:\Users\Admin\env\Lib\site-packages\osgeo>ogrinfo myapp/data/TM_WORLD_BORDERS-0.3.shp
Trả lờiXóaERROR 1: Can't load requested DLL: C:\Users\Admin\env\Lib\site-packages\osgeo\gdalplugins\ogr_FileGDB.dll
126: The specified module could not be found.
ERROR 1: Can't load requested DLL: C:\Users\Admin\env\Lib\site-packages\osgeo\gdalplugins\ogr_FileGDB.dll
126: The specified module could not be found.
bạn xem có thể hướng dẫn giúp mình được không
Chào bạn,
XóaTrước tiên bạn kiểm tra xem đường dẫn C:\Users\Admin\env\Lib\site-packages\osgeo\gdalplugins\ogr_FileGDB.dll có tồn tại không nhé.
Nếu đường dẫn tồn tại, bạn kiểm tra xem phân quyền của file ogr_FileGDB.dll có cho phép các action của current user ko.
Cuối cùng bạn chạy CMD bằng quyền administrator, để đảm bảo có đầy đủ quyền hạn truy cập file.
Nếu không giải quyết được bạn reply nhé.