天天看點

python3安裝web.py和psutil

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即可。