0

I use Python 3.4 as 'python3' in terminal (Python 2.7 as 'python'). I recently installed Python 3.6 with Homebrew, but I cannot seem to replace the 3.4 version under 'python3' with 3.6.

I tried this, but I get an error and "Operation not permitted". I'm figuring I need to change a path somewhere, but I'm not sure which files to change.


EDIT: The answer to this question did not solve my problem, I'm fine keeping the default as it is. It does make me realise that maybe just changing the alias is enough, or it that not the appropriate way to go about this? (e.g. this)

vander
  • 548
  • 7
  • 15
  • Possible duplicate of [python homebrew by default](https://stackoverflow.com/questions/5157678/python-homebrew-by-default) – Laurent LAPORTE Jul 10 '17 at 11:30
  • Thank you for pointing that out. I have seen that post before, but it was not what I was looking for, so that's why I didn't include a link to it. – vander Jul 10 '17 at 11:32

2 Answers2

0

To use your newly installed Python, follow ths link: python homebrew by default

Instead of changing the alias named "python3", you could use a virtualenv, that way, you can choose your Python version:

virtualenv -p python3.6 my_venv
source my_venv/bin/activate
python --version
# -> Python 3.6.1

Why do you use homebrew to install a new version of Python 3? You could have done directly from Mac OS X.

Laurent LAPORTE
  • 21,958
  • 6
  • 58
  • 103
  • When I first started working with Python that was probably also one of the first times opening a terminal window. At the time this solution worked, and it seemed like a convenient way to manage things. I never know exactly what the underlying implementation is, so when doing things manually there's always a fear of breaking things. The virtual environment works, but I also found this question https://stackoverflow.com/questions/42477834/python-3-6-path-confusion. Can I just simply change the alias, or is that not a proper way to do it? EDIT: Sorry, I hit enter too fast. – vander Jul 10 '17 at 11:45
0

I ended up reinstalling, manually removing/reinstalling versions and packages, and then relinked the alias to the Python version I wanted to use. This setup seems to work for me so far.

vander
  • 548
  • 7
  • 15