The final start command in the file opens up P圜harm with connections to the qgis Python libraries. The file should look like this before you save it, with your proper paths in place. Leave all quotation marks in place, they ensure spaces in the path are properly handled. Start “P圜harm aware of Quantum GIS” /B “\bin\pycharm.exe” Set PYTHONPATH=%PYTHONPATH% \apps\qgis\python
Setting environmental variables with the batch fileĬopy the following text into your batch file in Notepad replacing with the path to the QGIS installation folder you identified previously and with the P圜harm off
It will open up Notepad to edit your file. Right click your cmd file and select “Edit”. The process for creating them is quite simple, simply create a new text file anywhere on your computer by right clicking in the directory and selecting new -> Text Document (the desktop is a good place) and rename the file extension to “.cmd” Regardless of where you have installed your respective software packages, copy the paths to a text file for future use.Ī batch file file is a command line script for Windows that runs commands as though you are typing them into the command prompt terminal. Please note that this is in the root of the C: drive and not in Program Files QGIS could be in any folder but if you have installed multiple versions of it make sure to select the proper installation. P圜harm will be under a directory called Jetbrains.
However, if you installed the 32 bit versions of your software into a 64 bit windows environment you will likely have to look in the Program Files (x86) directory. If you have installed the 64 bit versions of both software packages you will likely end up looking in the Program Files directory: You can do this by navigating in Windows Explorer and looking for those two applications.
Not everyone installs QGIS to the default folder, nor does everyone install the same version of QGIS so it is imperative that you identify the following paths as they exist on your computer. While this isn’t strictly necessary, it does make the development process a touch nicer. Unfortunately, unlike ArcPy you can’t just set the interpreter to the included Python 3.7 installation for QGIS and have P圜harm be aware of the QGIS modules. Using an IDE (Integrated Development Environment) like P圜harm can help keep everything in one place and even integrates version control systems like Git.
Developing plugins and other Python scripts can be a daunting task for the uninitiated.