12

is there any means of telling QGIS to use a different Python installation than the default, system-wide one? E.g. use some virtualenv Python /myvirtualenv/bin/python instead of /usr/bin/python?

Background: I'm developing a custom plugin that uses some modules which are only installed in a certain virtualenv, but not system-wide.

The virtualenv is allowed to access system-wide packages, so the qgis core libs should still be accessible when using that virtualenv.

The only solution that I see right now is to install the required modules in the system-wide Python. However, I'd like to keep them in the virtualenv only, if possible.

PolyGeo
  • 65,136
  • 29
  • 109
  • 338
Matthias Loeks
  • 223
  • 2
  • 5

2 Answers2

6

You can first load your virtual environment and then start QGIS in the same terminal where you loaded the virtual environment.

for example in linux:

source /myvirtualenv/bin/activate
qgis
PolyGeo
  • 65,136
  • 29
  • 109
  • 338
Tom-db
  • 466
  • 1
  • 4
  • 12
2

I cannot guarantee this will work but perhaps you could try setting a custom variable to load your python version:

System Environment

Joseph
  • 75,746
  • 7
  • 171
  • 282