码迷,mamicode.com
首页 > 编程语言 > 详细

python3.6安装memory_profiler

时间:2020-05-03 20:32:01      阅读:108      评论:0      收藏:0      [点我收藏+]

标签:success   成功   man   pid   wrap   file   token   version   for   

1. 在centos中安装memory_profiler

pip3 install memory_profiler

报了个错:

    running build_ext
    building ‘psutil._psutil_linux‘ extension
    creating build/temp.linux-x86_64-3.6
    creating build/temp.linux-x86_64-3.6/psutil
    gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -DPSUTIL_POSIX=1 -DPSUTIL_SIZEOF_PID_T=4 -DPSUTIL_VERSION=570 -DPSUTIL_LINUX=1 -I/usr/include/python3.6m -c psutil/_psutil_common.c -o build/temp.linux-x86_64-3.6/psutil/_psutil_common.o
    psutil/_psutil_common.c:9:20: fatal error: Python.h: No such file or directory
     #include <Python.h>
                        ^
    compilation terminated.
    error: command ‘gcc‘ failed with exit status 1

    ----------------------------------------
Command "/usr/bin/python3 -u -c "import setuptools, tokenize;__file__=‘/tmp/pip-build-ctdkmofk/psutil/setup.py‘;f=getattr(tokenize, ‘open‘, open)(__file__);code=f.read().replace(‘\r\n‘, ‘\n‘);f.close();exec(compile(code, __file__, ‘exec‘))" install --record /tmp/pip-nuiv1vvh-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-ctdkmofk/psutil/

解决方式:

sudo yum install python3-devel

2.重新安装memory_profiler

pip3 install memory_profiler

输出如下:

Collecting memory_profiler
  Downloading http://mirrors.tencentyun.com/pypi/packages/f4/03/175d380294b2333b9b79c2f2aa235eb90ee95e3ddef644497a9455404312/memory_profiler-0.57.0.tar.gz
Collecting psutil (from memory_profiler)
  Downloading http://mirrors.tencentyun.com/pypi/packages/c4/b8/3512f0e93e0db23a71d82485ba256071ebef99b227351f0f5540f744af41/psutil-5.7.0.tar.gz (449kB)
    100% |████████████████████████████████| 450kB 1.5MB/s
Installing collected packages: psutil, memory-profiler
  Running setup.py install for psutil ... done
  Running setup.py install for memory-profiler ... done
Successfully installed memory-profiler-0.57.0 psutil-5.7.0

ok. 成功!记一下备忘。

python3.6安装memory_profiler

标签:success   成功   man   pid   wrap   file   token   version   for   

原文地址:https://www.cnblogs.com/lyg-blog/p/12823083.html

(0)
(1)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!