python pip install 安装包时的错误

  1. 1pip install aiohttp出现错误:
unable to execute 'gcc': No such file or directory

error: command 'gcc' failed with exit status 1
image.png

解决方法:

缺少gcc依赖环境 报错提示:

unable to execute gcc: No such file or directory

error: command 'gcc' failed with exit status

解决: yum -y install gcc

  1. 继续安装,然后出现如下错误:

    multidict/_multidict.c:1:10: fatal error: Python.h: No such file or directory

    include "Python.h"

          ^~~~~~~~~~
    

    compilation terminated.

    error: command 'gcc' failed with exit status 1

python pip install 安装包时的错误_第1张图片
image.png

解决方法:

sudo yum install python-devel # for python2.x installs

sudo yum install python3-devel # for python3.x installs

参考资料:

  1. CentOS安装报错:unable to execute gcc: No such file or directory:https://www.jianshu.com/p/21bb4ac6afb5

  2. fatal error: Python.h: No such file or directory:https://stackoverflow.com/questions/21530577/fatal-error-python-h-no-such-file-or-directory

Looks like you haven't properly installed the header files and static libraries for python dev. Use your package manager to install them system-wide.

For apt (Ubuntu, Debian...):

sudo apt-get install python-dev # for python2.x installs

sudo apt-get install python3-dev # for python3.x installs

For yum (CentOS, RHEL...):

sudo yum install python-devel # for python2.x installs

sudo yum install python3-devel # for python3.x installs

For dnf (Fedora...):

sudo dnf install python2-devel # for python2.x installs

sudo dnf install python3-devel # for python3.x installs

For zypper (openSUSE...):

sudo zypper in python-devel # for python2.x installs

sudo zypper in python3-devel # for python3.x installs

For apk (Alpine...):

This is a departure from the normal Alpine naming# scheme, which uses py2- and py3- prefixes

sudo apk add python2-dev # for python2.x installs

sudo apk add python3-dev # for python3.x installs

For apt-cyg (Cygwin...):

apt-cyg install python-devel # for python2.x installs

apt-cyg install python3-devel # for python3.x installs

Try locate Python.h and see if you already have the file before you do all this. If you can find the file located, mostly this answer will work: stackoverflow.com/a/19344978/4954434 (It might be just a path issue)

I'm using python3.6 on 14.04 apt-get install python3.6-dev worked for me.

On Ubuntu, I was running Python 3 and I had to install

sudo apt-get install python3-dev

If you want to use a version of Python that is not linked to python3, install the associated python3.x-dev package. For example:

sudo apt-get install python3.5-dev

你可能感兴趣的:(python pip install 安装包时的错误)