0

I'm trying to cleanup Python on my Mac. I keep getting this message in Terminal:

Your PYTHONPATH points to a site-packages dir for Python 3.x but you are running Python 2.x! PYTHONPATH is currently: "/Applications/QGIS3.10.app/Contents/Resources/python" You should unset PYTHONPATH to fix this.

What is going on? Why does QGIS keep setting my PYTHONPATH to itself? I keep resetting my PYTHONPATH with unset PYTHONPATH but then this keeps happening anyway.

Update 1: I think Python 2 and Python 3 both use the same PYTHONPATH, so I will have to figure out a workaround. The answers on this SE post may help: https://stackoverflow.com/questions/34066261/how-to-set-different-pythonpath-variables-for-python3-and-python2-respectively. Will post an update if I get it working...

Update 2 (and Solution): The problem is that I set my .bash_profile to QGIS. I forgot I had done this trying to solve another problem I had several months ago, which didn't work, but I never reversed the changes I made. So, problem officially solved.

  • 1
    If it was added to your .bash_profile when it was installed, it will keep on coming back every time you start a new shell until you take it out from there. (Maybe also inspect .bashrc and .profile if they exist in your home directory, and strictly speaking also any files sourced by any of these.) – tripleee Feb 7 at 17:11
  • @tripleee before I consider removing it do you know why QGIS would have added itself to it? Or why any application would add itself to the .bash_profile? – Kristen G. Feb 7 at 17:39
  • @triplee Wait a second. Maybe this makes sense. Maybe I don't want to remove it. Maybe it's not a problem when I'm using Python 3. Is this just an issue of my having both Python 2 and 3 on my computer at the same time? Is there only one PYTHONPATH between them that they share? Is that what's causing the issue? – Kristen G. Feb 7 at 17:45
  • Yup, this SE thread is asking the question more clearly than me (because I didn't realize the PYTHONPATH was the same for both installs). I'll try these answers out... stackoverflow.com/questions/34066261/… – Kristen G. Feb 7 at 17:48
  • @tripleee Commenting here as well as on my SO post. It was me who changed it. D'oh. I just had zero memory of doing it until I re-read this question I had posted a few months ago. I removed those lines and now everything is working. gis.stackexchange.com/questions/341486/… – Kristen G. Feb 7 at 20:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.