Changes

Jump to: navigation, search

Orange Pi Zero 2W

346 bytes added, 14:13, 26 September 2023
How to compile and install Python source code
=== How to compile and install Python source code ===
{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big>'''If the Python version in the Ubuntu or Debian system software repository you are using does not meet the development requirements and you want to use the latest version of Python, you can use the following method to download the Python source code package to compile and install the latest version of Python.'''
'''The following demonstration is to compile and install the latest version of Python 3.9. If you want to compile and install other versions of Python, the method is the same (you need to download the source code corresponding to the Python you want to install).'''</big>|}
<ol style="list-style-type: decimal;">
<li><p>First install the dependency packages needed to compile Python</p>
{| class="wikitable" style="width:800px;"
|-
|
<p>orangepi@orangepi:~$ '''sudo apt-get update'''</p>
<p>orangepi@orangepi:~$ '''sudo apt-get install -y build-essential zlib1g-dev \'''</p>
<p>'''libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libsqlite3-dev \'''</p>
<p>'''libreadline-dev libffi-dev curl libbz2-dev'''</p>|}</li>
<li><p>Then download the latest version of Python3.9 source code and unzip it</p>
{| class="wikitable" style="width:800px;"
|-
|
<p>orangepi@orangepi:~$ '''wget \'''</p>
<p>[https://www.python.org/ftp/python/3.9.10/Python-3.9.10.tgz '''https://www.python.org/ftp/python/3.9.10/Python-3.9.10.tgz''']</p><p>orangepi@orangepi:~$ '''tar xvf Python-3.9.10.tgz'''</p>|}</li>
<li><p>Then run the configuration command</p>
{| class="wikitable" style="width:800px;"
|-
|
<p>orangepi@orangepi:~$ '''cd Python-3.9.10'''</p>
<p>orangepi@orangepi:~$ '''./configure --enable-optimizations'''</p>|}</li>
<li><p>Then compile and install Python3.9. The compilation time takes about half an hour.</p>
{| class="wikitable" style="width:800px;"
|-
|
<p>orangepi@orangepi:~$ '''make -j4'''</p>
<p>orangepi@orangepi:~$ '''sudo make altinstall'''</p>|}</li>
<li><p>After installation, you can use the following command to check the version number of the Python you just installed.</p>
{| class="wikitable" style="width:800px;"
|-
|
<p>orangepi@orangepi:~$ '''python3.9 --version'''</p>
<p>'''Python 3.9.10'''</p>|}</li>
<li><p>Then update pip</p>
{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''/usr/local/bin/python3.9 -m pip install --upgrade pip'''</p>|}</li></ol>
<span id="how-to-replace-pip-source-in-python"></span>
 
=== How to replace pip source in Python ===

Navigation menu