I am trying to upgrade python version 2.6 to 3.5 using pip on a virtual environment but don't know correct command.
Asked
Active
Viewed 3,915 times
0
-
_but getting errors_ .can you please add it to your question. – scharette Nov 06 '17 at 20:26
-
Possible duplicate of [upgade python version using pip](https://stackoverflow.com/questions/16769109/upgade-python-version-using-pip) – Patrick Haugh Nov 06 '17 at 20:28
-
Also, please show the commands you are running. – Nov 06 '17 at 20:29
-
@scharette I am trying to find out correct command – Nov 06 '17 at 20:29
-
You can't upgrade Python itself with pip – juanpa.arrivillaga Nov 06 '17 at 20:33
-
Assuming you have Python 3.5 installed already, the usual procedure for upgrading a virtualenv is to create a _new_ virtualenv with the new Python version and then reinstall your packages into the new virtualenv. Trying to upgrade a virtualenv in place is unlikely to work well. – Nov 06 '17 at 20:33
-
@Blurp I need to each time start virtual env and install from scratch, each time its taking python 2.6 and not any newer version. – Nov 06 '17 at 20:34
-
Possible duplicate of [Use different Python version with virtualenv](https://stackoverflow.com/questions/1534210/use-different-python-version-with-virtualenv) – Nov 06 '17 at 20:37
-
Possible duplicate of [How to change the python version that a virtual environment uses in Ubuntu 14.04?](https://stackoverflow.com/questions/37302931/how-to-change-the-python-version-that-a-virtual-environment-uses-in-ubuntu-14-04) – phd Nov 06 '17 at 22:14
2 Answers
1
Just install the python3 and use an alias. Removing python2 from your system is a very bad idea.

gpopides
- 718
- 5
- 13
-2
Install Python3.x
sudo add-apt-repository ppa:jonathonf/python-3.x
sudo apt update
sudo apt install python3.x
Then change the default Python
sudo rm /usr/bin/python
sudo ln -s /usr/bin/python3 /usr/bin/python
Check the default
python -V

miador
- 1
- 4
-
2
-
-
-
Could you add your errors while installing? Which installation package do you use in your virtual machine?(apt,yum,pacman etc.) – miador Nov 06 '17 at 20:37