木叶下

  • 编程算法
  • 深度学习
  • 微小工作
  • 善用软件
  • 杂记
  • 诗人远方
南国羽说
文字记录生活
  1. 首页
  2. 杂记
  3. 正文

How to install Python in Ubuntu 在Ubuntu编译安装Python

2021年5月27日 4546点热度 2人点赞 0条评论

How to install Python in Ubuntu

This is an old school topic. You may be professional in Python, Java, C++, and Rust. You may use conda in your research. But what about commercial use? Conda is not free. Sometimes you need a pure Python environment, especially when you are using Docker to build an image.

本文将介绍如何在ubuntu18.04系统编译安装Python。不使用apt-get或者conda.

假设你已经是root user. 首先,安装必要的依赖

apt-get update && apt-get upgrade -y &&\
    apt-get install -y wget \
    build-essential zlib1g-dev libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libreadline-dev libffi-dev

下载并编译Python 3.8.0

wget https://www.python.org/ftp/python/3.8.0/Python-3.8.0.tgz &&\
    tar -xf Python-3.8.0.tgz &&\
    cd Python-3.8.0 &&\
    ./configure --enable-optimizations &&\
    make -j8 &&\
    make altinstall

设置这个Python3.8为默认的Python3,pip3.8为默认的pip3

update-alternatives --install /usr/bin/python3 python3 /usr/local/bin/python3.8 3 &&\
    update-alternatives --install /usr/bin/pip3 pip3 /usr/local/bin/pip3.8 3 &&\
    pip3 install --upgrade pip
标签: Python Ubuntu
最后更新:2021年6月7日

Dong Wang

I am a PhD student of TU Graz in Austria. My research interests include Embedded/Edge AI, efficient machine learning, model sparsity, deep learning, computer vision, and IoT. I would like to understand the foundational problems in deep learning.

点赞
< 上一篇
下一篇 >

文章评论

razz evil exclaim smile redface biggrin eek confused idea lol mad twisted rolleyes wink cool arrow neutral cry mrgreen drooling persevering
取消回复

这个站点使用 Akismet 来减少垃圾评论。了解你的评论数据如何被处理。

文章目录
  • How to install Python in Ubuntu

COPYRIGHT © 2013-2024 nanguoyu.com. ALL RIGHTS RESERVED.

Theme Kratos Made By Seaton Jiang

陕ICP备14007751号-1