Edit readme

This commit is contained in:
Alireza Adli 2023-12-14 13:49:56 -05:00
parent eed31fc887
commit 259628d420

View File

@ -8,26 +8,28 @@ To use PyQGIS without having the QGIS application run in the background, one nee
2. Assign a specific name to the QGIS Python executable:
This is being done in order to access the QGIS Python from the command prompt without mixing with the systems original Python installation(s).
a. Go to the QGIS installation directorys Python folder. E.g. C:\Program Files\QGIS 3.34.1\apps\Python39
a. Go to the QGIS installation directorys Python folder. e.g. C:\Program Files\QGIS 3.34.1\apps\Python39
b. Duplicate the Python executable (python.exe) by copy-pasting it
c. Rename the duplicated version. E.g. pythonqgis.exe
3. Updating the Path variables
a. Go to Environmental Variables (from Windows start)
b. Click on Path and then click on Edit. Add the following paths:
i. C:\Program Files\QGIS 3.34.1\apps\Python39\pythonqgis
ii. C:\Program Files\QGIS 3.34.1\apps\Python39
c. Go back to the Environmental variables this time click on New and in New Variable box enter PYTHONPATH and in the Variable Value add the following paths (separate them with a colon). Some paths might be different. For example, apps\qgis can be apps\qgis-ltr.
i. C:\Program Files\QGIS 3.34.1\apps\qgis\python
a. Go to Environmental Variables (from Windows start)
b. Click on Path and then click on Edit. Add the following paths:
i. C:\Program Files\QGIS 3.34.1\apps\Python39\pythonqgis
ii. C:\Program Files\QGIS 3.34.1\apps\Python39
c. Go back to the Environmental variables this time click on New and in New Variable box enter PYTHONPATH and in the Variable Value add the following paths (separate them with a colon). Some paths might be different. For example, apps\qgis can be apps\qgis-ltr.
i. C:\Program Files\QGIS 3.34.1\apps\qgis\python
ii. C:\Program Files\QGIS 3.34.1\apps\qgis\python\plugins
iii. C:\Program Files\QGIS 3.34.1\apps\Qt5\plugins
iv. C:\Program Files\QGIS 3.34.1\apps\gdal\share\gdal
v. Or altogether: C:\Program Files\QGIS 3.34.1\apps\qgis\python;C:\Program Files\QGIS 3.34.1\apps\qgis\python\plugins;C:\Program Files\QGIS 3.34.1\apps\Qt5\plugins;C:\Program Files\QGIS 3.34.1\apps\gdal\share\gdal
4. Validate importing qgis.core
a. Open a command prompt window
b. Enter pythonqgis
c. If the process has been done correctly, you wont face any error.
d. In the Python environment, import the package by:
i. Either import qgis.core
ii. Or from qgis.core import \*
b. Enter pythonqgis
c. If the process has been done correctly, you wont face any error.
d. In the Python environment, import the package by:
i. Either import qgis.core
ii. Or from qgis.core import \*