简体   繁体   English

缺少Python.h,无法找到

[英]Missing Python.h and impossible to find

I know there are already similar questions about the missing Python.h but NO solution worked for me by now. 我知道关于丢失的Python.h已经存在类似的问题,但是到目前为止,没有解决方案对我有用。

I need Python libraries in order to use Tossim, which is a tinyOS simulator ( http://tinyos.net ). 我需要Python库才能使用Tossim,这是一个tinyOS模拟器( http://tinyos.net )。

Python appears to be already installed on my Ubuntu 12.04 system. Python似乎已经安装在我的Ubuntu 12.04系统上。 In fact whenever I run the command 实际上,每当我运行命令时

$ python -V

I get the output 2.7.3 我得到输出2.7.3

Anyway when I try to locate Python.h no file is found. 无论如何,当我尝试找到Python.h时,找不到文件。 Python libraries are located in usr/lib/ but no headers in the folder. Python库位于usr / lib /中,但该文件夹中没有标题。

Mind that I already tried the most common solution for this problem, that is $ sudo apt-get install python-dev , and also $ sudo apt-get update . 请记住,我已经尝试了针对此问题的最常见解决方案,即$ sudo apt-get install python-dev$ sudo apt-get update None of them worked for me. 他们都没有为我工作。

What should I do now? 我现在应该怎么办? I tried to remove and reinstall python-dev, with no success. 我试图删除并重新安装python-dev,但没有成功。 I only think to manually download and place the header into the folder usr/lib/python2.7. 我只认为手动下载标题并将其放置在文件夹usr / lib / python2.7中。 But I doubt it is a good idea. 但是我怀疑这是一个好主意。 Can somebody help me? 有人可以帮我吗? Thank you in advance.` 预先谢谢您。

Ubuntu (and Debian) stores Python include files in /usr/include/python2.7 . Ubuntu(和Debian)将Python包含文件存储在/usr/include/python2.7 If the python2.7-dev package is installed (a dependency of python-dev ) then Python.h will be located at: 如果已安装python2.7-dev软件包( python-dev的依赖项),则Python.h将位于:

/usr/include/python2.7/Python.h

You can locate what packages contain the file with the command: 您可以使用以下命令找到哪些软件包包含文件:

dpkg -S Python.h

or list what files are installed with a package with: 或列出以下软件包附带的文件:

dpkg -L python2.7-dev

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM