Centos7安装Python模块pstuil

本文提供了在不同操作系统上安装psutil的方法,包括Linux(Ubuntu/Debian及RedHat/CentOS)、Windows等。针对Linux,详细介绍了使用包管理器进行安装的过程;对于Windows,则提供了预编译安装方式及从源代码编译所需环境配置的信息。

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

psutil官网

Linux

Ubuntu / Debian:

sudo apt-get install gcc python-dev python-pip
sudo pip install psutil

RedHat / CentOS:

sudo yum install gcc python-devel python-pip
sudo pip install psutil

If you're on Python 3 use python3-dev and python3-pip instead.


Windows

The easiest way to install psutil on Windows is to just use the pre-compiled exe/wheel installers hosted on PYPI via pip:

C:\Python27\python.exe -m pip install psutil

If you want to compile psutil from sources you'll need Visual Studio (Mingw32 is no longer supported), which really is a mess. The VS versions are the onle listed below. This blog post provides numerous info on how to properly set up VS (good luck with that).

Compiling 64 bit versions of Python 2.6 and 2.7 with VS 2008 requires Windows SDK and .NET Framework 3.5 SP1. Once installed run vcvars64.bat, then you can finally compile (see here). To compile / install psutil from sources on Windows run:

make.bat build
make.bat install

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值