python3安装web.py和psutil

本文介绍了如何在Python环境中正确安装web.py和psutil模块。对于web.py,指出了使用pip3安装的具体版本要求;对于psutil,给出了解决安装过程中出现的Python.h文件缺失问题的方法。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

1.安装web.py

安装web.py的python3.x的版本不能直接pip3 install web.py,因为会报一堆错误, 要想用pip3安装可以执行pip3 install web.py==0.40.dev0

2.安装psutil

安装psutil时,直接执行pip3 install psutil, 报错可能如下:
building 'psutil._psutil_linux' extension
creating build/temp.linux-x86_64-3.4
creating build/temp.linux-x86_64-3.4/psutil
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -fPIC -DPSUTIL_POSIX=1 -DPSUTIL_VERSION=545 -DPSUTIL_LINUX=1 -I/usr/include/python3.4m -c psutil/_psutil_common.c -o build/temp.linux-x86_64-3.4/psutil/_psutil_common.o
psutil/_psutil_common.c:9:20: fatal error: Python.h: 没有那个文件或目录
#include <Python.h>
^
compilation terminated.
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

此时需要安装python-devel库,我的系统是ubuntu,执行:
apt-get install python3-dev即可。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值