简体   繁体   English

跨平台Python可执行文件

[英]Cross-platform Python Executables

Is it possible to package together a Python executable that can be run across any platform - provided the correct version of Python is installed? 如果安装了正确版本的Python,是否可以将可以在任何平台上运行的Python可执行文件打包在一起?

If, for example, I created a Web Scraping script which included files such as chromium webdriver, the selenium package and other non-builtin Python packages, could I compile some .exe / .jar file that could be sent to a client to run this without having to configure an environment? 例如,如果我创建了一个Web Scraping脚本,其中包含诸如Chrome WebDriver,Selenium程序包和其他非内置Python程序包之类的文件,我是否可以编译一些.exe / .jar文件,并将其发送给客户端以运行此文件无需配置环境?

Python is mainly cross platform - although I've had experience of reading/writing files being different on Windows/OS X/Linux because of the different directory and file structure (see Reading and Writing Files for how to cope with that). Python主要是跨平台的-尽管我曾在Windows / OS X / Linux上读写文件有所不同,但由于目录和文件结构不同而有所不同(有关如何处理,请参阅读写文件 )。 Cross-platform Python for a GUI application is supposedly harder to do (reference: Reddit , I personally have never created a GUI in Python). 用于GUI应用程序的跨平台Python据说更难做到(参考: Reddit ,我个人从未在Python中创建过GUI)。

It depends on what you want your Python program to do. 这取决于您希望Python程序执行的操作。 If you want to install programs and packages then I don't think Python is your answer. 如果您想安装程序和软件包,那么我不认为Python是您的答案。 Also, Python is not included by default on every system, and even when it is installed, you're not guaranteed to have the correct version running on each system. 另外,默认情况下,并不是每个系统都包含Python,即使安装了Python,也不能保证在每个系统上都运行正确的版本。

This website looks useful for using Selenium with Python . 该网站对于将Selenium与Python结合使用非常有用。

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

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