[QGIS-Developer] QGIS's python as a virtualenv

David Marteau dmarteau at 3liz.com
Fri Dec 22 03:49:01 PST 2017


An easy way to do so is to add the path to the QGIS python packages in a PYTHONPATH env variable and the packages will be reachable from your virtual env.

Another (better) to do so would be having QGIS package packaged as pip/setuptools package so that they can be installed in any virtualenv - assuming that qgis libraires are already installed on
your platform.

This work well on Linux/OSX since QGis can rely on the python installed on your platform. On windows, this can be painful because of the way python interpreter is packaged, but I know very 
little about Qgis on Windows) .

David.


> Le 22 déc. 2017 à 11:07, Olivier Dalang <olivier.dalang at gmail.com> a écrit :
> 
> Hi !
> 
> I always have trouble when I need to use QGIS/OSGeo's python environment from outside of QGIS (e.g. setting up an IDE, running some custom scripts that need access to the same libraries than QGIS, etc...). Suggested solutions are to create some batch file, but I never really manage to make this work in a reasonable amount of time.
> 
> This contrasts very much with my experience with virtualenv (in non QGIS related python work), where switching from one python environment to another is extremely straightforward (source path_to_venv/bin/activate on linux or path_to_venv\Scripts\activate.bat on windows). With those commands, everything works : python, pip, all libraries, etc... I think most python IDEs support virtualenvs.
> 
> I'm not sure if this is possible or not, but would it be possible to have QGIS/OSGeo's python environment configured as a virtual environment ?
> 
> Thanks !
> 
> Olivier
> 
> 
> 
> 
> 
> 
> 
> 
> _______________________________________________
> QGIS-Developer mailing list
> QGIS-Developer at lists.osgeo.org
> List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20171222/6c883b03/attachment-0001.html>


More information about the QGIS-Developer mailing list