通过 apt-get 安装 python 3.5

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/38393054/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-19 20:43:41  来源:igfitidea点击:

Installing python 3.5 via apt-get

python

提问by James Franco

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

我正在尝试通过 apt-get 安装 python 3.5 我做了以下

> 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 updatebut that did not help as well

并且响应说它找不到python3.5。我试过这样做,apt-get update但这也无济于事

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

回答by Giordano

UPDATE

更新

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

感谢Don Kirkby,他强调有一个新的推荐 PPA。
更新的是ppa:deadsnakes/ppa,所以完整的命令如下:

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:

如果你使用的是 Ubuntu,你可以安装它并添加一个 PPA;所以你可以这样继续:

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:

如果此过程不起作用,则可能是您的 Ubuntu 版本不支持它。所以我认为你可以这样安装:

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

回答by chf

try with a simple search first:

首先尝试简单的搜索:

apt-cache search python | grep 3.5

apt-cache 搜索 python | grep 3.5

回答by Pratik Gujarathi

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:

下载 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