python2.7 - pip配置和安装模块问题

查看:590
本文介绍了python2.7 - pip配置和安装模块问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

问 题

系统环境

  • centos 7.2

  • pytohn 2.7.5

pip配置信息

输入pip list,提示:

DEPRECATION: The default format will switch to columns in the future. You can use --format=(legacy|columns) (or define a format=(legacy|columns) in your pip.conf under the [list] section) to disable this warning.

然后我在/root/.pip/pip.conf写入:

[list]
list_format=columns

还是有上面的那句警告。怎么解?

安装ansible

使用pip方式安装ansible

pip install ansible

安装不成功,一直报错

Command "/usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-AClS41/cryptography/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-DsXkPd-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-AClS41/cryptography/

前文是

creating build/temp.linux-x86_64-2.7
    generating cffi module 'build/temp.linux-x86_64-2.7/_constant_time.c'
    generating cffi module 'build/temp.linux-x86_64-2.7/_openssl.c'
    building '_openssl' extension
    creating build/temp.linux-x86_64-2.7/build
    creating build/temp.linux-x86_64-2.7/build/temp.linux-x86_64-2.7
    gcc -pthread -fno-strict-aliasing -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 -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 -I/usr/include/python2.7 -c build/temp.linux-x86_64-2.7/_openssl.c -o build/temp.linux-x86_64-2.7/build/temp.linux-x86_64-2.7/_openssl.o
    build/temp.linux-x86_64-2.7/_openssl.c:12:24: fatal error: pyconfig.h: No such file or directory
     #  include <pyconfig.h>
                            ^
    compilation terminated.
    error: command 'gcc' failed with exit status 1

这个怎么破?

解决方案

第一个问题

人家说了是

[list]
format=columns

第二个

没有python的头文件,也就是说没有安装python的开发库

sudo yum install python-dev python3-dev

这篇关于python2.7 - pip配置和安装模块问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆