I just bought a MacBook Pro and the preinstalled version of python is 2.7.x and I was attempting to install biopython
but that requires python 3.6 and higher.
I then downloaded the latest python which is 3.8.5.
When I run terminal to install biopython
I get an error saying that biopython
requires version above 3.6 to run and that version 2.7 is downloaded.
How can I make it so it recognizes version 3.8.5 or any version above 3.6?
Asked
Active
Viewed 9,662 times
2

Harshit Ruwali
- 1,040
- 2
- 10
- 22

Chris
- 59
- 1
- 9
3 Answers
2
For your terminal to run python 3.x run
python3 <your command>
and similarly for pip
pip3 install <package name>
Or you can just make a virtual environment. Ref here.

Harshit Ruwali
- 1,040
- 2
- 10
- 22
2
Symlink python to python3 in /usr/bin
. If you ever need to access python 2.7 run python2.7.
brew install python3
brew link
sudo mv /usr/bin/python /usr/bin/python2.7 # skip this step if /usr/bin/python2.7 already exists
ln -s /usr/local/bin/python $(which python3) # note /usr/local/bin instead of /usr/bin
Note:
Use brew
(ubiquitous open source MacOS package manager) to install python3. This will make maintaining package installs, versions and updates a lot simpler.
References:
Brew: https://brew.sh

pygeek
- 7,356
- 1
- 20
- 41
-
1Here he have already installed python3.x. And so what he have to is update the path for python3. – Harshit Ruwali Sep 18 '20 at 19:34
-
1@HarshitRuwali You installed python, but there's no easy way to update it and other packages that you install in the future without using a package manager. But yes, you need to update the symlink in /usr/bin to point to python3. – pygeek Sep 18 '20 at 19:37
0
I've checked docs for biopython https://biopython.org/wiki/Download and they ask you to run
pip install biopython
So what you have to ensure is that your pip
uses Python 3+ like here
> pip -V
pip 20.2.2 from /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pip (python 3.7)

Łukasz
- 127
- 1
- 5
-
1you can't run a pip command like that on MacOS without being in a virtual environment. You have to use the `python3 -m pip install
` or you can use the outdated pip3 wrapper. – monsieuralfonse64 Sep 18 '20 at 21:20