Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/macos/9.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
如何为Mac OS X构建和安装P4Python?_Python_Macos_Perforce_P4python - Fatal编程技术网

如何为Mac OS X构建和安装P4Python?

如何为Mac OS X构建和安装P4Python?,python,macos,perforce,p4python,Python,Macos,Perforce,P4python,我无法为Intel Mac OS X 10.5.5构建 以下是我的步骤: 我下载了p4python.tgz(从 )扩大 将其转换为“P4Python-2007.3” 我下载了p4api.tar(从 ) 并将其扩展为“p4api-2007.3.143793” 我将“p4api-2007.3.143793”放入“P4Python-2007.3”并进行编辑 setup.cfg设置“p4_api=。/p4api-2007.3.143793” 我添加了一行'extra_link_args=[“-frame

我无法为Intel Mac OS X 10.5.5构建

以下是我的步骤:

  • 我下载了p4python.tgz(从 )扩大 将其转换为“P4Python-2007.3”
  • 我下载了p4api.tar(从 ) 并将其扩展为“p4api-2007.3.143793”
  • 我将“p4api-2007.3.143793”放入“P4Python-2007.3”并进行编辑 setup.cfg设置“p4_api=。/p4api-2007.3.143793”
  • 我添加了一行'extra_link_args=[“-framework”,“Carbon”]'到 setup.py之后:

    elif unameOut[0] == "Darwin":
        unix = "MACOSX"
        release = "104"
        platform = self.architecture(unameOut[4])
    
  • 我运行了
    python setup.py build
    ,得到了:

  • $python setup.py build

    API Release 2007.3
    running build
    running build_py
    running build_ext
    building 'P4API' extension
    gcc -fno-strict-aliasing -Wno-long-double -no-cpp-precomp -mno-fused-madd -DNDEBUG -g -O3 -Wall -Wstrict-prototypes -DID_OS="MACOSX104X86" -DID_REL="2007.3" -DID_PATCH="151416" -DID_API="2007.3" -DID_Y="2008" -DID_M="04" -DID_D="09" -I./p4api-2007.3.143793 -I./p4api-2007.3.143793/include/p4 -I/build/toolchain/mac32/python-2.4.3/include/python2.4 -c P4API.cpp -o build/temp.darwin-9.5.0-i386-2.4/P4API.o -DOS_MACOSX -DOS_MACOSX104 -DOS_MACOSXX86 -DOS_MACOSX104X86
    cc1plus: warning: command line option "-Wstrict-prototypes" is valid for C/ObjC but not for C++
    P4API.cpp: In function âint P4Adapter_init(P4Adapter*, PyObject*, PyObject*)â:
    P4API.cpp:105: error: âPy_ssize_tâ was not declared in this scope
    P4API.cpp:105: error: expected `;' before âposâ
    P4API.cpp:107: error: âposâ was not declared in this scope
    P4API.cpp: In function âPyObject* P4Adapter_run(P4Adapter*, PyObject*)â:
    P4API.cpp:177: error: âPy_ssize_tâ was not declared in this scope
    P4API.cpp:177: error: expected `;' before âiâ
    P4API.cpp:177: error: âiâ was not declared in this scope
    error: command 'gcc' failed with exit status 1
    
    哪个gcc
    返回/usr/bin/gcc和
    gcc-v
    返回:

    Using built-in specs.
    Target: i686-apple-darwin9
    Configured with: /var/tmp/gcc/gcc-5465~16/src/configure
    --disable-checking -enable-werror --prefix=/usr --mandir=/share/man
    --enable-languages=c,objc,c++,obj-c++
    --program-transform-name=/^[cg][^.-]*$/s/$/-4.0/
    --with-gxx-include-dir=/include/c++/4.0.0 --with-slibdir=/usr/lib
    --build=i686-apple-darwin9 --with-arch=apple --with-tune=generic
    --host=i686-apple-darwin9 --target=i686-apple-darwin9
    Thread model: posix
    gcc version 4.0.1 (Apple Inc. build 5465)
    
    python-V
    返回python 2.4.3。

    From建议在python 2.5中添加Py_ssize_t,因此它在python 2.4中无法工作(没有一些修改)


    安装/编译您自己的python 2.5/2.6副本,或者研究如何更改python,或者寻找替代的python Performance库。

    非常过时,但您现在可以使用较新版本的python 2.4构建2008.1

    我已经在我的P4Python页面上发布了实现这一点所需的小改动,但它们已经被纳入了官方版本


    Robert

    使用LC_ALL=C进行编译可能会很有用,这样gcc就可以输出普通的引号,而不是扩展字符。