BreeeZe / rpos

Raspberry Pi Onvif Server
http://breeeze.github.io/rpos
MIT License
643 stars 146 forks source link

For those suffering from ‘rU’ or 'gyp' error. #173

Open bleeee opened 3 weeks ago

bleeee commented 3 weeks ago

Make a python2 environment

要在树莓派上安装 Python 2.7.18,可以按照以下步骤进行。我们将从源代码编译安装 Python 2.7.18,因为官方包管理器可能不再提供 Python 2 的安装包。

步骤 1:更新包管理器 首先,更新你的包管理器和安装必要的构建工具:

bash 复制代码 sudo apt-get update sudo apt-get upgrade sudo apt-get install build-essential checkinstall sudo apt-get install libreadline-gplv2-dev libncursesw5-dev libssl-dev libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev zlib1g-dev openssl libffi-dev 步骤 2:下载 Python 2.7.18 源代码 从 Python 官方网站下载 Python 2.7.18 源代码包:

bash 复制代码 cd /usr/src sudo wget https://www.python.org/ftp/python/2.7.18/Python-2.7.18.tgz 步骤 3:解压源代码包 解压下载的源代码包:

bash 复制代码 sudo tar xzf Python-2.7.18.tgz 步骤 4:编译 Python 源代码 进入解压后的目录并编译安装 Python:

bash 复制代码 cd Python-2.7.18 sudo ./configure --enable-optimizations sudo make altinstall 注意: 使用 altinstall 而不是 install,以避免覆盖系统默认的 Python 版本。

步骤 5:验证安装 安装完成后,验证 Python 2.7.18 是否成功安装:

bash 复制代码 python2.7 --version 设置 Python 2.7.18 为默认 Python 版本 如果你希望将 Python 2.7.18 设置为默认 Python 版本,可以使用 update-alternatives 工具:

bash 复制代码 sudo update-alternatives --install /usr/bin/python python /usr/local/bin/python2.7 1 然后选择 Python 2.7.18 作为默认版本:

bash 复制代码 sudo update-alternatives --config python 选择与 /usr/local/bin/python2.7 相关联的选项。

验证默认 Python 版本 确认默认 Python 版本已更改为 Python 2.7.18:

bash 复制代码 python --version 通过以上步骤,你应该能够在树莓派上成功安装 Python 2.7.18 并将其设置为默认的 Python 版本。

libreadline-gplv2-dev 无法安装 ChatGPT 如果你在尝试安装 libreadline-gplv2-dev 时遇到问题,可以尝试安装其他相关的库或使用 libreadline-dev 代替。以下是详细的步骤:

步骤 1:更新包管理器 首先,更新你的包管理器:

bash 复制代码 sudo apt-get update sudo apt-get upgrade 步骤 2:安装构建工具和依赖库 尝试安装必要的构建工具和其他依赖库:

bash 复制代码 sudo apt-get install build-essential checkinstall sudo apt-get install libreadline-dev libncursesw5-dev libssl-dev libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev zlib1g-dev openssl libffi-dev 步骤 3:下载 Python 2.7.18 源代码 从 Python 官方网站下载 Python 2.7.18 源代码包:

bash 复制代码 cd /usr/src sudo wget https://www.python.org/ftp/python/2.7.18/Python-2.7.18.tgz 步骤 4:解压源代码包 解压下载的源代码包:

bash 复制代码 sudo tar xzf Python-2.7.18.tgz 步骤 5:编译 Python 源代码 进入解压后的目录并编译安装 Python:

bash 复制代码 cd Python-2.7.18 sudo ./configure --enable-optimizations sudo make altinstall 注意: 使用 altinstall 而不是 install,以避免覆盖系统默认的 Python 版本。

步骤 6:验证安装 安装完成后,验证 Python 2.7.18 是否成功安装:

bash 复制代码 python2.7 --version 设置 Python 2.7.18 为默认 Python 版本 如果你希望将 Python 2.7.18 设置为默认 Python 版本,可以使用 update-alternatives 工具:

bash 复制代码 sudo update-alternatives --install /usr/bin/python python /usr/local/bin/python2.7 1 然后选择 Python 2.7.18 作为默认版本:

bash 复制代码 sudo update-alternatives --config python 选择与 /usr/local/bin/python2.7 相关联的选项。

验证默认 Python 版本 确认默认 Python 版本已更改为 Python 2.7.18:

bash 复制代码 python --version 通过以上步骤,你应该能够在树莓派上成功安装 Python 2.7.18 并将其设置为默认的 Python 版本。如果在任何步骤中遇到问题,请确保你的系统包管理器是最新的,并且你有足够的权限执行这些命令。

bleeee commented 3 weeks ago

libcamera actually replace this repo. thanks for author effort!