---
# System prepended metadata

title: Ubuntu部署Django 4專案系列-依賴項與Python3.9源代碼安裝

---

# Ubuntu部署Django 4專案系列-依賴項與Python3.9源代碼安裝


> [name=Sharon Mai] [time=20230414, Fri] [color=#907bf7]

## ↪️總目錄：[Ubuntu部署Django 4專案全系列](https://hackmd.io/@ppp300a/ubuntu-django-4/)

{%hackmd a0ktF64jQXalgAyZHtiXbQ %}



## 指令說明
* `apt-get`指令較資深
* `apt`有更好的使用者體驗(顯示進度條、顯示顏色更醒目)、Ubuntu 16.04開始取代apt-get

## 基本安裝
```
sudo apt update
```
```
sudo apt install zlib1g
```
```
sudo apt install zlib1g.dev
```
```
sudo apt install bzip2
```
```
sudo apt install libncurses5-dev libncursesw5-dev
```
```
sudo apt install libreadline-dev
```
```
sudo apt install openssl
```
```
sudo apt install libssl-dev
```
```
sudo apt install xz-utils
```
```
sudo apt install sqlite3
```
```
sudo apt install libgdbm-dev
```
```
sudo apt install -y tk-dev
```
```
sudo apt install libmysqlclient-dev 
```
```
sudo apt install python
```
```
sudo apt install  libffi-dev
```

## Python3.9源代碼安裝
> 目的：需要安裝一個特定版本的 Python
1. 允許直接用網路載點下載
    ```
    sudo apt install wget
    ```
    
2. 創建個python3的資料夾
    ```
    home/../
    ```
    ```
    mkdir python3
    ```
3. cd 到Python3的資料夾中
    ```
    cd python3
    ```

4. 下載Python3.9
    ```
    wget https://www.python.org/ftp/python/3.9.0/Python-3.9.0.tar
    ```
    
5. 解壓縮
    ```
    tar -xvf Python-3.9.0.tgz
    ```
6. 到解完壓縮的3.9資料夾中
    ```
    cd Python-3.9.0
    ```
7. 執行以下命令即可~
    ```
    sudo ./configure
    ```
    ```    
    sudo make all
    ```
    ```
    sudo make install
    ```