Cygwin gcc问题-找不到python

时间:2021-10-17 20:27:31

So I downloaded Cygwin to build Matplotlib on Windows. Upon running

所以我下载了Cygwin在Windows上构建Matplotlib。在运行

python setup.py build

python的设置。py构建

I get a message saying Python.h cannot be found (pastebin).

我收到一条消息说Python。无法找到h (pastebin)。

Looking in /usr/include/python2.7, I can clearly see Python.h exists.

在/usr/include/python2.7中,我可以清楚地看到Python。h的存在。

When I do:

当我做:

gcc -print-search-dirs

gcc -print-search-dirs

I get paths to some Haskell folder outside of the cygwin installation folder. Full output here.

我获得路径到cygwin安装文件夹之外的Haskell文件夹。完整的输出。

3 个解决方案

#1


20  

in cygwin make sure the python-devel package is installed:

在cygwin中,确保安装了python-devel包:

  • Run the cygwin installer (setup-x86(_64).exe
  • 运行cygwin安装程序(setup-x86(_64).exe)
  • Click through until you get to the page to install packages
  • 点击进入页面安装包
  • install the "python-devel" package from the "python" section. [Update from Comments] It is available as python2-devel or python3-devel under Python section for some.
  • 从“python”部分安装“python-devel”包。[来自注释的更新]它可以作为Python部分下的python2-devel或python3-devel使用。

#2


2  

I realize your question is old but I stumbled upon the exact same problem and found the solution so I thought I would share it. You probably have another gcc installed outside of cygwin, in my case it was a mingw-tdm native windows gcc variant. It happened to be in the path before the actual cygwin gcc, and was therefore picked up by the python installer.

我知道你的问题已经过时了,但我无意中发现了同样的问题,并找到了解决方案,所以我想我应该分享一下。您可能在cygwin之外安装了另一个gcc,在我的示例中是一个mingw-tdm本机windows gcc变体。它碰巧位于实际cygwin gcc之前的路径中,因此被python安装程序选中。

To solve the problem, you only need to locate (or install) the cygwin gcc you need (either 32 or 64-bit), and do

要解决这个问题,您只需定位(或安装)您需要的cygwin gcc(32位或64位),然后就可以了

export CC=/path/to/correct/gcc/exe

for instance

例如

export CC=/usr/bin/x86_64-pc-cygwin-gcc

#3


0  

This looks similar to the following discussion on ubuntu forums:

这与下面在ubuntu论坛上的讨论类似:

http://ubuntuforums.org/archive/index.php/t-2136273.html

http://ubuntuforums.org/archive/index.php/t - 2136273. - html

one of the solutions is to "sudo apt-get build-dep python-matplotlib", while other solution is to check whether you are compiling with correct python. Python 2 uses MPL < 1.2 and python 3 MPL >= 1.2.

其中一个解决方案是“sudo apt-get build-dep python-matplotlib”,而另一个解决方案是检查您是否使用了正确的python进行编译。Python 2使用MPL < 1.2, Python 3 MPL >= 1.2。

#1


20  

in cygwin make sure the python-devel package is installed:

在cygwin中,确保安装了python-devel包:

  • Run the cygwin installer (setup-x86(_64).exe
  • 运行cygwin安装程序(setup-x86(_64).exe)
  • Click through until you get to the page to install packages
  • 点击进入页面安装包
  • install the "python-devel" package from the "python" section. [Update from Comments] It is available as python2-devel or python3-devel under Python section for some.
  • 从“python”部分安装“python-devel”包。[来自注释的更新]它可以作为Python部分下的python2-devel或python3-devel使用。

#2


2  

I realize your question is old but I stumbled upon the exact same problem and found the solution so I thought I would share it. You probably have another gcc installed outside of cygwin, in my case it was a mingw-tdm native windows gcc variant. It happened to be in the path before the actual cygwin gcc, and was therefore picked up by the python installer.

我知道你的问题已经过时了,但我无意中发现了同样的问题,并找到了解决方案,所以我想我应该分享一下。您可能在cygwin之外安装了另一个gcc,在我的示例中是一个mingw-tdm本机windows gcc变体。它碰巧位于实际cygwin gcc之前的路径中,因此被python安装程序选中。

To solve the problem, you only need to locate (or install) the cygwin gcc you need (either 32 or 64-bit), and do

要解决这个问题,您只需定位(或安装)您需要的cygwin gcc(32位或64位),然后就可以了

export CC=/path/to/correct/gcc/exe

for instance

例如

export CC=/usr/bin/x86_64-pc-cygwin-gcc

#3


0  

This looks similar to the following discussion on ubuntu forums:

这与下面在ubuntu论坛上的讨论类似:

http://ubuntuforums.org/archive/index.php/t-2136273.html

http://ubuntuforums.org/archive/index.php/t - 2136273. - html

one of the solutions is to "sudo apt-get build-dep python-matplotlib", while other solution is to check whether you are compiling with correct python. Python 2 uses MPL < 1.2 and python 3 MPL >= 1.2.

其中一个解决方案是“sudo apt-get build-dep python-matplotlib”,而另一个解决方案是检查您是否使用了正确的python进行编译。Python 2使用MPL < 1.2, Python 3 MPL >= 1.2。