xixiha's Blogs

https://github.com/xixiha5230/

0%

openwrt安装peewee

直接安装

直接安装会报错

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
root@OpenWrt:~# pip uninstall peewee
Found existing installation: peewee 3.17.0
Uninstalling peewee-3.17.0:
Would remove:
/usr/bin/pwiz.py
/usr/lib/python3.10/site-packages/peewee-3.17.0-py3.10.egg
Proceed (Y/n)? y
Successfully uninstalled peewee-3.17.0
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
root@OpenWrt:~# pip install peewee
Collecting peewee
Using cached peewee-3.17.0.tar.gz (2.9 MB)
error: subprocess-exited-with-error

× pip subprocess to install build dependencies did not run successfully.
│ exit code: 2
╰─> See above for output.

note: This error originates from a subprocess, and is likely not a problem with pip.
Installing build dependencies ... error
error: subprocess-exited-with-error

× pip subprocess to install build dependencies did not run successfully.
│ exit code: 2
╰─> See above for output.

note: This error originates from a subprocess, and is likely not a problem with pip.

通过源码安装

1
2
3
git clone https://github.com/coleifer/peewee.git
cd peewee
python setup.py install

会出现如下报错

1
2
3
4
5
6
7
8
9
10
oot@OpenWrt:~/peewee# python setup.py install
...
/tmp/tmp_pw_sqlite3_1wb7m_b7/test_pw_sqlite3.c:1:10: fatal error: sqlite3.h: No such file or directory

1 | #include <sqlite3.h>

| ^~~~~~~~~~~

compilation terminated.
...

openwrt无法直接安装sqlite3,需要通过sqlite3源码来安装,下载源码

1
2
3
4
5
6
7
8
9
10
11
12
# 先安装依赖
opkg install grep
opkg install make

wget https://sqlite.org/2023/sqlite-autoconf-3440000.tar.gz
tar -zxvf sqlite-autoconf-3440000.tar.gz
cd sqlite-autoconf-3440000
./configure --prefix=/usr

make -j1
make install
# ldconfig: not found 可以忽略

安装完成后回到 peewee

1
2
3
4
5
6
# 先更新setuptools
pip install --upgrade setuptools

python setup.py clean
python setup.py install
# playhouse/_sqlite_ext.c: No such file or directory 可以忽略

完成~