Python 安装zbar-py时出现 无法打开包括文件: “unistd.h” no such file or directory
问题

途中使用的命令是cl.exe,在执行命令的时候找不到对应的unistd.h文件。
unistd.h是Unix系统的文件,因此,十有八九,使用的是Windows系统。下面的代码可以修复,但是如果修复了unistd.h,很大概率你还会有更多个*.h文件找不到。劝退。
解决
找到这个编译器所在的文件夹的include文件夹,并且unistd.h文件复制进去即可。可以新建一个文本文件,把名字和后缀名改为unistd.h。
#ifndef _UNISTD_H
#define _UNISTD_H 1
/* This is intended as a drop-in replacement for unistd.h on Windows.
* Please add functionality as neeeded.
* https://stackoverflow.com/a/826027/1202830
*/
#include <stdlib.h>
#include <io.h>
#include <getopt.h> /* getopt at: https://gist.github.com/ashelly/7776712 */
#include <process.h> /* for getpid() and the exec..() family */
#include <direct.h> /* for _getcwd() and _chdir() */
#define srandom srand
#define random rand
/* Values for the second argument to access.
These may be OR'd together. */
#define R_OK 4 /* Test for read permission. */
#define W_OK 2 /* Test for write permission. */
//#define X_OK 1 /* execute permission - unsupported in windows*/
#define F_OK 0 /* Test for existence. */
#define access _access
#define dup2 _dup2
#define execve _execve
#define ftruncate _chsize
#define unlink _unlink
#define fileno _fileno
#define getcwd _getcwd
#define chdir _chdir
#define isatty _isatty
#define lseek _lseek
/* read, write, and close are NOT being #defined here, because while there are file handle specific versions for Windows, they probably don't work for sockets. You need to look at your app and consider whether to call e.g. closesocket(). */
#ifdef _WIN64
#define ssize_t __int64
#else
#define ssize_t long
#endif
#define STDIN_FILENO 0
#define STDOUT_FILENO 1
#define STDERR_FILENO 2
/* should be in some equivalent to <sys/types.h> */
typedef __int8 int8_t;
typedef __int16 int16_t;
typedef __int32 int32_t;
typedef __int64 int64_t;
typedef unsigned __int8 uint8_t;
typedef unsigned __int16 uint16_t;
typedef unsigned __int32 uint32_t;
typedef unsigned __int64 uint64_t;
#endif /* unistd.h */
Windows的通病
这样是不可行的,在许多情况下。原因是这个头文件是unix, standard的缩写,只有unix系统(Linux, Mac OS)才有。因此我们需要找到对应的Windows标准库,就是 io.h,把包含是unistd.h的地方,都替换成io.h即可。
Python 安装zbar-py时出现 无法打开包括文件: “unistd.h” no such file or directory的更多相关文章
- VS2012与VS2015同时安装用VS2012创建MFC程序时弹出编译错误”fatal error C1083: 无法打开包括文件:“mprapidef.h”: No such file or directory”的解决办法
在WIndows 7操作系统上同时安装VS2012与VS2015并用VS2012创建MFC程序时弹出编译错误”fatal error C1083: 无法打开包括文件:“mprapidef.h”: No ...
- fatal error C1083: 无法打开包括文件:“qedit.h”: No such file or directory
VS2010编译 DirectShow一些项目时遇到 错误:fatal error C1083: 无法打开包括文件:“qedit.h”: No such file or directory 解决方法: ...
- 无法打开包括文件:“SDKDDKVer.h”: No such file or directory
在已经装有Visual Studio 2010的系统中,同时安装Visual Studio 2012,安装过程很顺利,但到使用VS2013时,却出问题了. 本文主要介绍:VS中新建工程编译时出现,“无 ...
- 【解决】 无法打开包括文件:“windows.h”: No such file or directory
vs编译时错误: 无法打开包括文件:“windows.h”: No such file or directory 出现这种错误什么都不用配置(环境变量),最好办法是将VS安装在C盘,让开发工具自动包含 ...
- 无法打开包括文件:“windows.h”: No such file or directory
VS2012 出现如下错误: 无法打开包括文件:"windows.h": No such file or directory 解决办法,将 C:\Program Files ...
- afx.h(78): fatal error C1083: 无法打开包括文件: “new.h”: No such file or directory
vs2015新建mfc工程,编译错误: D:\program files (x86)\microsoft visual studio 14.0\vc\atlmfc\include\afx.h(78): ...
- fatal error C1083: 无法打开包括文件: “SDKDDKVer.h”: No such file or directory(转)
fatal error C1083: 无法打开包括文件: “SDKDDKVer.h”: No such file or directory 解决办法:(Vs2013中) 项目--右键--属性--配置属 ...
- ObjectARX2012错误1 fatal error C1083: 无法打开包括文件:“arxHeaders.h”: No such file or directory; fatal error C1083: 无法打开包括文件:“map”: No such file or directory
问题1:fatal error C1083: 无法打开包括文件:“arxHeaders.h”: No such file or directory: 解决办法:这个问题很明显,是因为没有在工程属性里包 ...
- VC++_错误 无法打开包括文件“glglut.h” No such file or directory 怎么办
在网上看到类似的问题,查找资料找到了解决方案,现整理如下,有些更改,好让自己多些印象,附原文网址:http://blog.csdn.net/bigloomy/article/details/62265 ...
随机推荐
- html 如何使表格一列都变颜色的简单方法!!
html怎么让一列变颜色用到属性colgroup 重点我都加粗了!! <colgroup span="3" bgcolor="yellow">&l ...
- 开发者在行动-政府侧IT需求志愿者招募令(第一弹)
京东云与AI推出了[应急资源信息发布平台],在打通物资供需的同时,各地政府及公益组织可发布疫情信息化产品开发及运维服务的IT需求,如疫情防控统计.物资供需信息收集等IT管理.需求通过评审后平台将帮助发 ...
- 吴裕雄 Bootstrap 前端框架开发——Bootstrap 字体图标(Glyphicons):glyphicon glyphicon-font
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta name ...
- python --- excel文件处理
1.安装第三方库:openpyxl 2.操作示例 from openpyxl import load_workbook #.打开文件 file = load_workbook("test.x ...
- tableau-参数
tableau参数可用在计算字段.筛选器和参考线中替换常量值得动态值. 三种方式:1.在计算字段中使用筛选器 案例动态替换计算字段中设定的目标值. 创建参数 以参数值创建计算字段 2.筛选器中使用参数 ...
- 吴裕雄--天生自然Django框架开发笔记:Django Nginx+uwsgi 安装配置
Django Nginx+uwsgi 安装配置 使用 python manage.py runserver 来运行服务器.这只适用测试环境中使用. 正式发布的服务,需要一个可以稳定而持续的服务器,比如 ...
- (简单模拟)P1540 机器翻译
题解: #include<iostream>#include<cmath>using namespace std; int main(){ int m,n; cin>&g ...
- redhat8 不支持ansible批量管理解决方案
redhat8默认不安装python,因此无法通过python去管理,直接上解决方案. dnf install python3 -y alternatives --set python /usr/bi ...
- [NOI2017]蔬菜(贪心+递推)
这题很有思维难度,乍一看基本无从下手. 给每个蔬菜钦定退役的时间显然很困难,可以考虑让时光倒流,从后向前递推,然后就变成了某个时间点有一部分蔬菜服役,而已经服役的蔬菜不会退役了.然后就可以直接考虑贪心 ...
- Qt creator中配置opencv win7 64bit
配置方法的原文来自https://www.librehat.com/qt-5-2-vs2012-opencv-2-4-7-dev-environment-setup-tutorial/. 补充,在张静 ...