3

I'm writing a standalone python script, and I need to use Qgis module. For information i'm working on a Mac and I already have Qgis 2.18 installed. So in list of module importation, I wrote this :

import qgis

But when I run my script, it returns me :

No module named 'qgis'

I search where it comes from, and apparently, it's because I have many python versions installed. And I dont use the one who is connected to Qgis.

I check my python install with this command which -a python python3and it returns :

/opt/local/bin/python
/usr/bin/python
/Library/Frameworks/Python.framework/Versions/3.6/bin/python3
/usr/local/bin/python3

According to python --version I'm using Python 3.4.7

Somebody can help me to use the good one ?

PolyGeo
65.5k29 gold badges115 silver badges349 bronze badges
asked Oct 12, 2017 at 13:53
2
  • Qgis 2.18 installed: how did you install Qgis, KyngChaos, Homebrew, ? Commented Oct 12, 2017 at 16:03
  • I used KyngChaos way Commented Oct 13, 2017 at 10:06

1 Answer 1

1

QGIS 2.18 uses python 2.7.

QGIS 3 will use python 3.

answered Oct 12, 2017 at 14:09
1
  • I used python --version to know my current version. It is Python 3.4.7. So i have to change current version to 2.7 and it will be ok ? How can I do that ? Commented Oct 12, 2017 at 14:13

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.