Nihal Warawdekar
Nihal Warawdekar

Reputation: 1

Installing modules to wrong python version

I'm currently running both Python 3.5 and 2.7 on my Mac. While installing modules and working on 3.5, I'm running into errors as some installations fail (installation is attempted for 2.7 and access is denied).

How do i specify the path to the python 3 folder? python 3.5 is saved in a weird location nowhere near where 2.7 is.

/Library/Frameworks/Python.framework/Versions/3.5

This is different from where python 2.7 is saved, for which the installation is going through normally when 3.5 isn't running.

/Library/Python/2.7

For instance, here is the error displayed to me on terminal while installing virtualenv.

enter image description here

Upvotes: 0

Views: 2041

Answers (1)

taleinat
taleinat

Reputation: 8691

First of all, it is highly recommended to use virtualenv to create isolated Python environments and install libraries only into these. Do this and avoid installing any libraries into the main Python version, except for virtualenv itself of course :) When you do so, one you've activated a specific virtualenv, pip will just work.

If you still decide you want to install a library outside of a virtualenv, the safest way to make sure you're using the pip for the right version of Python is this:

python35 -m pip install ...

(replace python35 with however you invoke the relevant version of Python)

Upvotes: 2

Related Questions