Wrong python-version in virtualenv [Solved (I think) It works now]

Hello.
I eariler had some problem with app.py in Ex50.
This was because I did not had python version 3.6.
I installed this and the problem was solved.
But when I activate virtualenv I still got 3.5.

I am not sure (because it was some weeks ago) but I think I had 3.6 once in the virtualenv.
I tried to change the default python3 to 3.6 with:

sudo update-alternatives --config python3

It helped when I am not in virtualenv. I tried both in and out of virtualenv.

When I tried to do “sudo pip install python3” when in virtualenv I got this:

The directory ‘/home/ulf/.cache/pip/http’ or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo’s -H flag.

Output of “ls -la” ( I have got Linux) will be:

drwx------ 16 ulf ulf 4096 okt 17 20:55 .
drwx------ 4 ulf ulf 4096 okt 17 20:55 …
drwx------ 3 ulf ulf 4096 aug 30 20:54 0
drwx------ 3 ulf ulf 4096 aug 23 21:04 1
drwx------ 3 ulf ulf 4096 aug 23 21:05 2
drwx------ 5 ulf ulf 4096 aug 30 20:54 3
I don’t list them all.

I guess I have to do chmod or chown.
If this is a solution I would like to have a advice before messing with this folder.
Or if there is other problem. I need help in this case.

I have no idea why it works now. I cannot explain what I did, or not did. But it works and I am happy again.

The virtualenv is still pointing at the old Python, so best thing is to just delete that directory and create a new one. Do this first though:

pip list

while inside your virtualenv. That will list all the packages you have to reinstall. Then, delete that virtualenv dir, make a new one with 3.6, and then go and add them again.