Ubuntu 20.04上的Python 3.7 [英] Python 3.7 on Ubuntu 20.04

查看:1024
本文介绍了Ubuntu 20.04上的Python 3.7的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在为Ubuntu 20.04准备一个docker映像,由于TensorFlow 2.0的要求,我需要Python 3.7. TensorFlow在Python 3.5至3.7上运行.运行apt install python3默认情况下会安装Python 3.8,这会中断我的TensorFlow安装.

I am preparing a docker image for Ubuntu 20.04 and due to TensorFlow 2.0 requirement, I need Python 3.7. TensorFlow runs on Python 3.5 to 3.7. Running apt install python3 installs Python 3.8 by default and that breaks my TensorFlow installation.

有什么办法可以获取适用于Ubuntu 20.04的Python 3.7的apt软件包吗?由于它将被放置在docker映像中,因此我不想从事下载Python 3.7源代码并进行编译的工作.将这些命令放在Dockerfile中对我来说是不堪重负的.有没有更简单的方法来为Ubuntu 20.04获取Python 3.7?

Is there any way I can get an apt package for Python 3.7 for Ubuntu 20.04? Since it is going to be inside docker image, I don't want to get into the business of downloading Python 3.7 source code and compiling. Putting those commands in Dockerfile will be overwhelming for me. Is there any simpler way of getting Python 3.7 for Ubuntu 20.04?

运行

sudo apt-cache madison python3

返回

python3 | 3.8.2-0ubuntu2 | http://in.archive.ubuntu.com/ubuntu focal/main amd64 Packages

推荐答案

是否需要Ubuntu 20.04? Ubuntu 18.04随附 Python 3.6

Do you need Ubuntu 20.04? Ubuntu 18.04 comes with Python 3.6, and 3.7 available.

如果您这样做,则 PPA死因具有

If you do, the deadsnakes PPA has Python 3.5-3.7 for Ubuntu 20.04 (Focal). To add it and install:

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

P.s.我不是开发人员,也没有Tensorflow的经验,所以请带一点盐.

P.s. I'm not a dev and have no experience with Tensorflow so take this with a grain of salt.

这篇关于Ubuntu 20.04上的Python 3.7的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆