09 Python C拓展在各平台的打包与发布 赵丰Python C拓展在各平台的打包 与发布 赵丰 GitHub ID: zhaofeng-shu33 在 Windows 平台上:没有找到编译器; 在 Unix 平台上: 无法解决软件依赖。 假如 numpy 官方的源只包含一堆 .c 文件 现在你要 pip install numpy 结果将是 1 为什么需要C拓展包 2 如何在不同的平台打包并发布 编写 setup.py else: do others 处理不同平台的差异 3 C拓展打包的注意事项 • 在 Linux 系统上打包无法上传到 pypi.org,只能用官方提供的 CentOS 6.10 Docker 打包 • C拓展包如果依赖额外的动态库需要一起打包进去并且在包导入的时候动 态添加PATH • 每一个Python版本打包的C拓展包相互独立,py37不能安装py36打包的 二进制包 • • 在Windows平台上需要预装 Visual Studio C++ 套件才能打包 4 用持续集成工具打包 • 以 Travis 为例,针对 MacOS 和 ManyLinux,示例配置文件如下: THANK YOU0 码力 | 6 页 | 414.79 KB | 1 年前3
7-韦泽华-一键将C和Cpp代码转换为Python能调用的代码一键将 C/C++ 代码转换为 Python 能调用的代码 韦泽华 大家以前都是怎样调用C++代码呢? 1. Cython 2. boost.python/pybind11 3. ctypes 先不讨论这些工具的优劣 先给大家介绍一下 如何使用c2py来调用C++代码 在此之前给大家看一下要调用的C++代码源文件 • 我肯定是会拿上期所的API来作示范: (看一眼就好了) c2py的使用分两步走 • 第一步,生成.pyd(.so)文件 • 第二步,调用代码,并享受完备的type hint。 与其他工具的用法进行一下比较? 与pybind11进行比较 • c2py:两个命令 • pybind11:1137行代码? • 不, 其实是11,376行代码: 跟pybind11比算个什么事?根本 不在一个次元! 要比就和不需要写C++代码的工 具比! 与ctypes进行比较 与ctypes进行比较 • c2py:调用代码,并享受type hint。 • ctypes:调用代码?? 如果把调用C++代码当作吃饭,那么: 工具 科技等级 手撸Cython 手撕猎物;钻木取火 Boost.python/pybind11 用猎枪打猎;在现代化的厨房里做菜 ctypes 在某个便利店里买吃的。(只卖番茄炒蛋) c2py 外卖app 所以 调用C++,认准 现代化的外卖app:c2py0 码力 | 12 页 | 1.24 MB | 1 年前3
Conda 23.3.x Documentationdependency and environment management for any language---Python, R, Ruby, Lua, Scala, Java, JavaScript, C/ C++, FORTRAN Conda is an open-source package management system and environment management system that including platform, version, dependencies, and build info { "arch": "x86_64", "build": "py37hfa4b5c9_1", "build_number": 1, "depends": [ "depend > 1.1.1" ], "license": "BSD 3-Clause", "name": "fun-packge" 7/site-packages/fun-packge/__init__.py", "path_type": "hardlink", "sha256": "76f3b6e34feeb651aff33ca59e0279c4eadce5a50c6ad93b961c846f7ba717e9", "size_in_bytes": 2067 (continues on next page) 1.1. Concepts 9 conda Documentation0 码力 | 370 页 | 2.94 MB | 8 月前3
Conda 23.5.x Documentationdependency and environment management for any language---Python, R, Ruby, Lua, Scala, Java, JavaScript, C/ C++, FORTRAN Conda is an open-source package management system and environment management system that including platform, version, dependencies, and build info { "arch": "x86_64", "build": "py37hfa4b5c9_1", "build_number": 1, "depends": [ "depend > 1.1.1" ], "license": "BSD 3-Clause", "name": "fun-packge" 7/site-packages/fun-packge/__init__.py", "path_type": "hardlink", "sha256": "76f3b6e34feeb651aff33ca59e0279c4eadce5a50c6ad93b961c846f7ba717e9", "size_in_bytes": 2067 (continues on next page) 1.1. Concepts 9 conda Documentation0 码力 | 370 页 | 3.11 MB | 8 月前3
Conda 25.1.x Documentationpermissions to install conda if you select a user-writable install location (e.g. /Users/my-username/conda or C:\Users\my-username\conda). Regular installation Follow the instructions for your operating system: Command Prompt window. 3. Navigate to the file. 4. Run the following command: Start-PsFCIV -Path C:\path\to\file.ext -HashAlgorithm SHA256 -Online • macOS: In iTerm or a terminal window enter shasum io/activation. If you receive this warning, you need to activate your environment. To do so on Windows, run: c:\Anaconda3\ Scripts\activate base in a terminal window. Windows is extremely sensitive to proper activation0 码力 | 822 页 | 5.20 MB | 8 月前3
Conda 24.11.x Documentationpermissions to install conda if you select a user-writable install location (e.g. /Users/my-username/conda or C:\Users\my-username\conda). Regular installation Follow the instructions for your operating system: Command Prompt window. 3. Navigate to the file. 4. Run the following command: Start-PsFCIV -Path C:\path\to\file.ext -HashAlgorithm SHA256 -Online • macOS: In iTerm or a terminal window enter shasum io/activation. If you receive this warning, you need to activate your environment. To do so on Windows, run: c:\Anaconda3\ Scripts\activate base in a terminal window. Windows is extremely sensitive to proper activation0 码力 | 818 页 | 5.21 MB | 8 月前3
Conda 23.7.x Documentationdependency and environment management for any language---Python, R, Ruby, Lua, Scala, Java, JavaScript, C/ C++, FORTRAN Conda is an open-source package management system and environment management system that including platform, version, dependencies, and build info { "arch": "x86_64", "build": "py37hfa4b5c9_1", "build_number": 1, "depends": [ "depend > 1.1.1" ], "license": "BSD 3-Clause", "name": "fun-packge" 7/site-packages/fun-packge/__init__.py", "path_type": "hardlink", "sha256": "76f3b6e34feeb651aff33ca59e0279c4eadce5a50c6ad93b961c846f7ba717e9", "size_in_bytes": 2067 (continues on next page) 1.1. Concepts 9 conda, Release0 码力 | 795 页 | 4.91 MB | 8 月前3
Conda 24.7.x Documentationpermissions to install conda if you select a user-writable install location (e.g. /Users/my-username/conda or C:\Users\my-username\conda). Regular installation Follow the instructions for your operating system: Command Prompt window. 3. Navigate to the file. 4. Run the following command: Start-PsFCIV -Path C:\path\to\file.ext -HashAlgorithm SHA256 -Online • macOS: In iTerm or a terminal window enter shasum io/activation. If you receive this warning, you need to activate your environment. To do so on Windows, run: c:\Anaconda3\ Scripts\activate base in a terminal window. Windows is extremely sensitive to proper activation0 码力 | 808 页 | 4.97 MB | 8 月前3
Conda 24.1.x Documentationpermissions to install conda if you select a user-writable install location (e.g. /Users/my-username/conda or C:\Users\my-username\conda). 12 Chapter 4. Contributors welcome conda, Release 24.1.2.dev2 Regular Command Prompt window. 3. Navigate to the file. 4. Run the following command: Start-PsFCIV -Path C:\path\to\file.ext -HashAlgorithm SHA256 -Online • macOS: In iTerm or a terminal window enter shasum io/activation. If you receive this warning, you need to activate your environment. To do so on Windows, run: c:\Anaconda3\ Scripts\activate base in a terminal window. 26 Chapter 4. Contributors welcome conda,0 码力 | 795 页 | 4.73 MB | 8 月前3
Conda 23.9.x Documentationdependency and environment management for any language---Python, R, Ruby, Lua, Scala, Java, JavaScript, C/ C++, FORTRAN Conda is an open-source package management system and environment management system that including platform, version, dependencies, and build info { "arch": "x86_64", "build": "py37hfa4b5c9_1", "build_number": 1, "depends": [ "depend > 1.1.1" ], "license": "BSD 3-Clause", "name": "fun-packge" 7/site-packages/fun-packge/__init__.py", "path_type": "hardlink", "sha256": "76f3b6e34feeb651aff33ca59e0279c4eadce5a50c6ad93b961c846f7ba717e9", "size_in_bytes": 2067 (continues on next page) 1.1. Concepts 9 conda, Release0 码力 | 753 页 | 4.86 MB | 8 月前3
共 581 条
- 1
- 2
- 3
- 4
- 5
- 6
- 59













