I looked at the previous questions on this topic, but they don't seem to cover this odd issue.
I had a 2.7.x based virtualenv
at ~/GP
for an older version of my Django installation. However, I moved this to ~/GP_old
and moved a new Django installation to ~/GP
along with its associated virtualenv
based on Python 3.5.x.
However, I noticed that the despite being in the virtualenv
with the correct Python version, python
still calls the 2.7.x version. Very strange.
Using which
shows that despite being in the activated virtualenv
, python
refers to the system-wide version (2.7.x). Is the virtualenv
bound to the location one created it in (in my case this was ~/GP_beta
)? If so, how do I update it?
I could delete the virtualenv
and create a new version and reinstall my packages as well, but in some cases it seems smart to be able to fix it.
Activating virtualenv
and checking python
version:
mint@mint-VirtualBox ~/GP $ source env/bin/activate
(env) mint@mint-VirtualBox ~/GP $ python
Python 2.7.6 (default, Mar 22 2014, 22:59:56)
[GCC 4.8.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>>
Verifying the version in the virtualenv
is actually the correct one:
(env) mint@mint-VirtualBox ~/GP $ cd env/bin
(env) mint@mint-VirtualBox ~/GP/env/bin $ ls -la
total 3736
drwxr-xr-x 3 mint mint 4096 Aug 8 05:53 .
drwxr-xr-x 4 mint mint 4096 Aug 8 05:53 ..
-rw-r--r-- 1 mint mint 2081 Aug 8 05:53 activate
-rw-r--r-- 1 mint mint 1023 Aug 8 05:53 activate.csh
-rw-r--r-- 1 mint mint 2221 Aug 8 05:53 activate.fish
-rw-r--r-- 1 mint mint 1137 Aug 8 05:53 activate_this.py
-rwxr-xr-x 1 mint mint 286 Aug 8 05:53 django-admin
-rwxr-xr-x 1 mint mint 145 Aug 8 05:53 django-admin.py
-rwxr-xr-x 1 mint mint 253 Aug 8 05:53 easy_install
-rwxr-xr-x 1 mint mint 253 Aug 8 05:53 easy_install-3.5
-rwxr-xr-x 1 mint mint 225 Aug 8 05:53 pip
-rwxr-xr-x 1 mint mint 225 Aug 8 05:53 pip3
-rwxr-xr-x 1 mint mint 225 Aug 8 05:53 pip3.5
drwxr-xr-x 2 mint mint 4096 Aug 8 05:53 __pycache__
lrwxrwxrwx 1 mint mint 9 Aug 8 05:53 python -> python3.5
lrwxrwxrwx 1 mint mint 9 Aug 8 05:53 python3 -> python3.5
-rwxr-xr-x 1 mint mint 3759688 Aug 8 05:53 python3.5
-rwxr-xr-x 1 mint mint 2340 Aug 8 05:53 python-config
-rwxr-xr-x 1 mint mint 232 Aug 8 05:53 wheel
Which python installation does python
point to?
(env) mint@mint-VirtualBox ~/GP/env/bin $ which python
/usr/bin/python