Python / Cygwin:通过pip使用pip安装模块失败

时间:2018-09-05 21:25:06

标签: python pip cygwin

我已经在Cygwin中安装了版本2和版本3的python,后来又安装了pip。但是,每当我尝试使用pip安装任何模块时,都会出现以下错误:

$ pip install regex
Collecting regex
  Using cached https://files.pythonhosted.org/packages/2a/0a/944977367c8a6cfcfa6fcb8ac6b1f0f9a667c1f34194091c766b5d7c44d7/regex-2018.08.29.tar.gz
Building wheels for collected packages: regex
  Running setup.py bdist_wheel for regex ... error
  Complete output from command /usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-pg3NIK/regex/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /tmp/pip-wheel-6upLG0 --python-tag cp27:
  /usr/lib/python2.7/site-packages/setuptools/dist.py:398: UserWarning: Normalizing '2018.08.29' to '2018.8.29'
    normalized_version,
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib.cygwin-2.11.1-x86_64-2.7
  copying regex_2/regex.py -> build/lib.cygwin-2.11.1-x86_64-2.7
  copying regex_2/_regex_core.py -> build/lib.cygwin-2.11.1-x86_64-2.7
  copying regex_2/test_regex.py -> build/lib.cygwin-2.11.1-x86_64-2.7
  running build_ext
  building '_regex' extension
  creating build/temp.cygwin-2.11.1-x86_64-2.7
  creating build/temp.cygwin-2.11.1-x86_64-2.7/regex_2
  gcc -fno-strict-aliasing -ggdb -O2 -pipe -Wimplicit-function-declaration -fdebug-prefix-map=/usr/src/ports/python2/python2-2.7.14-1.x86_64/build=/usr/src/debug/python2-2.7.14-1 -fdebug-prefix-map=/usr/src/ports/python2/python2-2.7.14-1.x86_64/src/Python-2.7.14=/usr/src/debug/python2-2.7.14-1 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/usr/include/python2.7 -c regex_2/_regex.c -o build/temp.cygwin-2.11.1-x86_64-2.7/regex_2/_regex.o
  regex_2/_regex.c:46:10: fatal error: Python.h: No such file or directory
   #include "Python.h"
            ^~~~~~~~~~
  compilation terminated.
  error: command 'gcc' failed with exit status 1

  ----------------------------------------
  Failed building wheel for regex

任何帮助将不胜感激。

0 个答案:

没有答案