Installing python and all its stuff maybe a bit confusing if you’re installing it using Macports (MacPorts - The MacOS package manager). By default, Macports comes with many python ports, e.g., python24, python27, python34. Each of them is a separate version of python (2.4, 2.7, 3.4,…). It provides the users the ability to install and maintain multiple version of python at the same time.
To browse all versions of python provided by Macports, use this command
To install a specific version of python
When you install python through Macports, it will auto install the python_select port. This is a tool for switching among python versions. To view all the the installed python versions, execute this one
To set one version as the default one, use port select
again
Similarly, before installing pip, search for all available versions of pip
Select the version of pip corresponding to the version of python that you are using and then install it
Again, you need to use port select
to set the version of pip to use. Select
the version corresponding to your running python version
Now, python and pip have been installed successfully. Make sure that the
Macports bin is in your PATH and stands before the default Mac OS one. When run
the command which
, it should be something similar to this
Now the best way to install virtualenv is to using pip