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.dal...@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@lists.osgeo.org > List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer > Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer
_______________________________________________ QGIS-Developer mailing list QGIS-Developer@lists.osgeo.org List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer