26
votes

I am attempting to install python 3.5 via apt-get I did the following

> sudo apt-get install python3.5
...
Unable to locate package python3.5

And the response says that it cant find python3.5. I tried doing apt-get update but that did not help as well

Any suggestions ? These are my details

PRETTY_NAME="Debian GNU/Linux 7 (wheezy)"
NAME="Debian GNU/Linux"
VERSION_ID="7"
VERSION="7 (wheezy)"
ID=debian
ANSI_COLOR="1;31"

More update:

apt-cache policy python3 python
python3:
  Installed: (none)
  Candidate: 3.2.3-6
  Version table:
     3.2.3-6 0
        500 http://ftp.us.debian.org/debian/ wheezy/main armhf Packages
python:
  Installed: 2.7.3-4+deb7u1
  Candidate: 2.7.3-4+deb7u1
  Version table:
 *** 2.7.3-4+deb7u1 0
        500 http://ftp.us.debian.org/debian/ wheezy/main armhf Packages
        100 /var/lib/dpkg/status
3
This is off topic for SO as it is not programming related. Also, if you post questions like these (no matter where) you should at least include which distro and version you're using. - mata
I dont think this is off topic - setting up an environment is not considered off topic. Also I included the details of my distro - James Franco
Search the Debian package database: debian.org/distrib/packages - Jesper

3 Answers

47
votes

UPDATE

Thanks to Don Kirkby who highlight that there is a new recommended PPA.
The updated one is ppa:deadsnakes/ppa, so the complete command is the following:

sudo add-apt-repository ppa:deadsnakes/ppa


If you are using Ubuntu, you can install it adding a PPA; so you can proceed in this way:

sudo add-apt-repository ppa:fkrull/deadsnakes
sudo apt-get update
sudo apt-get install python3.5

If this procedure doesn't work, is possible that your Ubuntu version not supported it. So i think that you can install in this way:

sudo apt-get install libssl-dev openssl
wget https://www.python.org/ftp/python/3.5.0/Python-3.5.0.tgz
tar xzvf Python-3.5.0.tgz
cd Python-3.5.0
./configure
make
sudo make install
-4
votes

try with a simple search first:

apt-cache search python | grep 3.5

-4
votes

Install dependencies:

sudo apt-get build-dep python3.2
sudo apt-get install libreadline-dev libncurses5-dev libssl1.0.0 tk8.5-dev zlib1g-dev liblzma-dev

Download Python 3.3.0:

wget http://python.org/ftp/python/3.3.0/Python-3.3.0.tgz

Extract:

tar xvfz Python-3.3.0.tgz
Configure and Install:
cd Python-3.3.0
./configure --prefix=/opt/python3.3
make  
sudo make install

Test if it worked:

/opt/python3.3/bin/python3