I have two versions of python on Mac OSX Yosemite, 2.7 and 3.5 and I have a virtual environment to switch the workspace to 3.5 version.
I switched the environment to python 3.5 and then install the selenium webdriver package using "sudo pip install selenium". It gets installed without any issues but then I tried to uninstall it and then noticed that it is asking for confirmation and then I noticed that the path was shown for python 2.7 version.
The paths are for python 2.7, why did the package got installed in 2.7 instead of 3.5 even though I was in a virtual environment of 3.5 version?
You could use pip3 instead of pip so you are sure that the 'pip' you are calling is the one related to python3.
pip3 install selenium
This often happens when you use pip
with sudo
. That is because the environmental variables created by the activate script in the virtualenv
are often valid only for the current user and not for the super user. You can confirm this by typing these two commands after activating the virtualenv
.
which python
sudo which python
You will see that the latter points to the system python installation.
One solution is to create the virtualenv in the userspace so that you don't need superuser privileges to make changes to it. The other is to do sudo -i
, activate the virtualenv and then do the pip install.