Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/regex/17.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/unix/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
安装Python';s的新正则表达式模块不工作_Python_Regex - Fatal编程技术网

安装Python';s的新正则表达式模块不工作

安装Python';s的新正则表达式模块不工作,python,regex,Python,Regex,我正在尝试安装以替换re,但在安装模块时遇到困难。我已经访问过这个,当遵循Pavan的指示时,终端(我正在运行OSX El Capitan)会产生以下输出: 编辑:为了澄清,此输出是在发出命令pip install regex时生成的 Collecting regex Using cached regex-2016.04.15.tar.gz Installing collected packages: regex Running setup.py install for regex ..

我正在尝试安装以替换re,但在安装模块时遇到困难。我已经访问过这个,当遵循Pavan的指示时,终端(我正在运行OSX El Capitan)会产生以下输出:

编辑:为了澄清,此输出是在发出命令
pip install regex
时生成的

Collecting regex
  Using cached regex-2016.04.15.tar.gz
Installing collected packages: regex
  Running setup.py install for regex ... error
    Complete output from command /usr/bin/python -u -c "import setuptools, tokenize;__file__='/private/var/folders/z6/vncx8j5977xd96vnrtj41xt40000gn/T/pip-build-AwqJ7Z/regex/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /var/folders/z6/vncx8j5977xd96vnrtj41xt40000gn/T/pip-uG2qOh-record/install-record.txt --single-version-externally-managed --compile:
    /Library/Python/2.7/site-packages/setuptools-20.9.0-py2.7.egg/setuptools/dist.py:285: UserWarning: Normalizing '2016.04.15' to '2016.4.15'
    running install
    running build
    running build_py
    creating build
    creating build/lib.macosx-10.11-intel-2.7
    copying Python2/regex.py -> build/lib.macosx-10.11-intel-2.7
    copying Python2/_regex_core.py -> build/lib.macosx-10.11-intel-2.7
    copying Python2/test_regex.py -> build/lib.macosx-10.11-intel-2.7
    running build_ext
    building '_regex' extension
    creating build/temp.macosx-10.11-intel-2.7
    creating build/temp.macosx-10.11-intel-2.7/Python2
    cc -fno-strict-aliasing -fno-common -dynamic -arch i386 -arch x86_64 -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -arch i386 -arch x86_64 -pipe -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c Python2/_regex.c -o build/temp.macosx-10.11-intel-2.7/Python2/_regex.o
    Python2/_regex.c:16531:77: warning: '&&' within '||' [-Wlogical-op-parentheses]
                                if (state->total_errors < error_limit || i == 0 &&
                                                                      ~~ ~~~~~~~^~
    Python2/_regex.c:16531:77: note: place parentheses around the '&&' expression to silence this warning
                                if (state->total_errors < error_limit || i == 0 &&
                                                                                ^
    Python2/_regex.c:16534:38: warning: variable 'better' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
                                else if (state->total_errors == error_limit)
                                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Python2/_regex.c:16542:33: note: uninitialized use occurs here
                                if (better) {
                                    ^~~~~~
    Python2/_regex.c:16534:34: note: remove the 'if' if its condition is always true
                                else if (state->total_errors == error_limit)
                                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Python2/_regex.c:16529:40: note: initialize the variable 'better' to silence this warning
                                BOOL better;
                                           ^
                                            = '\0'
    Python2/_regex.c:18564:28: warning: unused function 'match_get_group_dict' [-Wunused-function]
    Py_LOCAL_INLINE(PyObject*) match_get_group_dict(MatchObject* self) {
                               ^
    3 warnings generated.
    Python2/_regex.c:16531:77: warning: '&&' within '||' [-Wlogical-op-parentheses]
                                if (state->total_errors < error_limit || i == 0 &&
                                                                      ~~ ~~~~~~~^~
    Python2/_regex.c:16531:77: note: place parentheses around the '&&' expression to silence this warning
                                if (state->total_errors < error_limit || i == 0 &&
                                                                                ^
    Python2/_regex.c:16534:38: warning: variable 'better' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
                                else if (state->total_errors == error_limit)
                                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Python2/_regex.c:16542:33: note: uninitialized use occurs here
                                if (better) {
                                    ^~~~~~
    Python2/_regex.c:16534:34: note: remove the 'if' if its condition is always true
                                else if (state->total_errors == error_limit)
                                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Python2/_regex.c:16529:40: note: initialize the variable 'better' to silence this warning
                                BOOL better;
                                           ^
                                            = '\0'
    Python2/_regex.c:18564:28: warning: unused function 'match_get_group_dict' [-Wunused-function]
    Py_LOCAL_INLINE(PyObject*) match_get_group_dict(MatchObject* self) {
                               ^
    3 warnings generated.
    cc -fno-strict-aliasing -fno-common -dynamic -arch i386 -arch x86_64 -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -arch i386 -arch x86_64 -pipe -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c Python2/_regex_unicode.c -o build/temp.macosx-10.11-intel-2.7/Python2/_regex_unicode.o
    cc -bundle -undefined dynamic_lookup -arch i386 -arch x86_64 -Wl,-F. build/temp.macosx-10.11-intel-2.7/Python2/_regex.o build/temp.macosx-10.11-intel-2.7/Python2/_regex_unicode.o -o build/lib.macosx-10.11-intel-2.7/_regex.so
    running install_lib
    copying build/lib.macosx-10.11-intel-2.7/_regex.so -> /Library/Python/2.7/site-packages
    error: [Errno 13] Permission denied: '/Library/Python/2.7/site-packages/_regex.so'

    ----------------------------------------
Command "/usr/bin/python -u -c "import setuptools, tokenize;__file__='/private/var/folders/z6/vncx8j5977xd96vnrtj41xt40000gn/T/pip-build-AwqJ7Z/regex/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /var/folders/z6/vncx8j5977xd96vnrtj41xt40000gn/T/pip-uG2qOh-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/var/folders/z6/vncx8j5977xd96vnrtj41xt40000gn/T/pip-build-AwqJ7Z/regex/
收集正则表达式
使用缓存的regex-2016.04.15.tar.gz
安装收集的软件包:regex
正在运行regex的setup.py安装。。。错误
从命令/usr/bin/python-u-c“import setuptools,tokenize;uuu file_uuu=”/private/var/folders/z6/vncx8j5977xd96vnrtj41xt40000gn/T/pip-build-AwqJ7Z/regex/setup.py';exec(编译(getattr(tokenize,'open',open)(u file_uu).read().replace('\r\n','n'),uu file,'exec'))”安装--record/var/folders/z6/vncx8j5977xd96vnrtj41xt40000gn/T/pip-uG2qOh-record/install-record.txt--外部管理的单一版本--编译:
/Library/Python/2.7/site packages/setuptools-20.9.0-py2.7.egg/setuptools/dist.py:285:UserWarning:将“2016.04.15”规范化为“2016.4.15”
正在运行的安装
运行构建
运行build\u py
创建构建
创建build/lib.macosx-10.11-intel-2.7
复制Python2/regex.py->build/lib.macosx-10.11-intel-2.7
复制Python2/_regex_core.py->build/lib.macosx-10.11-intel-2.7
复制Python2/test_regex.py->build/lib.macosx-10.11-intel-2.7
运行build_ext
建筑物“\u regex”扩展
创建build/temp.macosx-10.11-intel-2.7
创建build/temp.macosx-10.11-intel-2.7/Python2
cc-fno严格别名-fno公共-动态-arch i386-arch x86_64-g-Os-pipe-fno公共-fno严格别名-fwrapv-DENABLE_DTRACE-DMACOSX-DNDEBUG-Wall-Wstrict原型-Wshorten-64-to-32-DNDEBUG-g-fwrapv-Os-Wall-Wstrict原型-DENABLE_DTRACE-arch i386-arch x86_64-pipe-I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7-c python2/_regex.c-o build/temp.macosx-10.11-intel-2.7/python2/_regex.o
Python2/_regex.c:16531:77:警告:“&&&”在“||”内[-Wlogical op括号]
如果(状态->总误差<误差极限| | i==0&&
~~ ~~~~~~~^~
Python2/_regex.c:16531:77:注意:在“&&”表达式周围加括号以使此警告静音
如果(状态->总误差<误差极限| | i==0&&
^
Python2/_regex.c:16534:38:警告:只要“if”条件为false,变量“better”就会在未初始化时使用[-Wsometimes uninitialized]
否则如果(状态->总错误==错误限制)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Python2/_regex.c:16542:33:注意:此处出现未初始化使用
如果(更好){
^~~~~~
Python2/_regex.c:16534:34:注意:如果“if”的条件始终为true,则删除它
否则如果(状态->总错误==错误限制)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Python2/_regex.c:16529:40:注意:初始化变量'better'以使此警告静音
布尔更好;
^
= '\0'
Python2/_regex.c:18564:28:警告:未使用的函数“match\u get\u group\u dict”[-Wunused function]
Py_本地_内联(PyObject*)匹配_获取_组_dict(MatchObject*self){
^
生成3个警告。
Python2/_regex.c:16531:77:警告:“&&&”在“||”内[-Wlogical op括号]
如果(状态->总误差<误差极限| | i==0&&
~~ ~~~~~~~^~
Python2/_regex.c:16531:77:注意:在“&&”表达式周围加括号以使此警告静音
如果(状态->总误差<误差极限| | i==0&&
^
Python2/_regex.c:16534:38:警告:只要“if”条件为false,变量“better”就会在未初始化时使用[-Wsometimes uninitialized]
否则如果(状态->总错误==错误限制)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Python2/_regex.c:16542:33:注意:此处出现未初始化使用
如果(更好){
^~~~~~
Python2/_regex.c:16534:34:注意:如果“if”的条件始终为true,则删除它
否则如果(状态->总错误==错误限制)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Python2/_regex.c:16529:40:注意:初始化变量'better'以使此警告静音
布尔更好;
^
= '\0'
Python2/_regex.c:18564:28:警告:未使用的函数“match\u get\u group\u dict”[-Wunused function]
Py_本地_内联(PyObject*)匹配_获取_组_dict(MatchObject*self){
^
生成3个警告。
cc-fno严格别名-fno common-dynamic-arch i386-arch x86_64-g-Os-pipe-fno common-fno严格别名-fwrapv-DENABLE_DTRACE-DMACOSX-DNDEBUG-Wall-Wstrict原型-Wshorten-64-to-32-DNDEBUG-g-fwrapv-Os-Wall-Wstrict原型-DENABLE_DTRACE-arch i386-arch x86_64-pipe-I/System/Library/Frameworks/Python.framework/Versionons/2.7/include/python2.7-c python2/_regex_unicode.c-o build/temp.macosx-10.11-intel-2.7/python2/_regex_unicode.o
cc-bundle-未定义的动态查找-arch i386-arch x86_64-Wl,-F.build/temp.macosx-10.11-intel-2.7/Python
Permission denied: '/Library/Python/2.7/site-packages/_regex.so'
$ sudo pip install regex