简体   繁体   English

在 Windows 机器上运行 python 对比 Linux [关闭]

[英]Running python on a Windows machine vs Linux [closed]

I am interested in learning python but my Linux skills suck.我有兴趣学习 python 但我的 Linux 技能很烂。 I would like to develop a medium to large scale web application using python and django but afraid the software may not work well on a windows box.我想使用 python 和 django 开发中型到大型 web 应用程序,但担心该软件在 windows 盒子上可能无法正常运行。 Is there a performance difference in running python on Linux vs Windows?在 Linux 和 Windows 上运行 python 有性能差异吗? Is there anything that I should watch out for when developing the application.开发应用程序时有什么我应该注意的吗? Also, I am aware that it is very easy integrating C++ libraries with python. Is this statement still true is the code is on a windows box?另外,我知道将 C++ 库与 python 集成起来非常容易。如果代码在 windows 盒子上,这个说法是否仍然正确?

Don't tell anybody this, but I've run python/django on windows. 不要告诉任何人这个,但我在windows上运行python / django。 It works all right and the performance hit isn't any worse than you would expect from windows. 它的工作正常,性能的提升并不比你对windows的期望差。 I used MySQL and it installed without a problem. 我使用MySQL并安装没有问题。 I had to grope around to find out how to manage it (no good ol' sudo /etc/init.d/mysql restart but i eventually found a graphical interface to do what I needed. 我不得不四处寻找如何管理它(没有好的' sudo /etc/init.d/mysql restart但我最终找到了一个图形界面来做我需要的东西。

but afraid the software may not work well on a windows box. 但担心软件可能无法在Windows机箱上正常工作。

Your software will work. 你的软件会起作用。 The Windows OS may not work as you hope. Windows操作系统可能无法正常工作。 But that's Windows, not Python. 但那是Windows,而不是Python。

We develop 100% on Windows. 我们在Windows上开发100%。 We completely test: Unit test, integration test and user acceptance test on Windows. 我们完全测试:Windows上的单元测试,集成测试和用户验收测试。 100%. 100%。

We deploy for production 0% on Windows, 100% on Linux. 我们在Windows上部署生产0%,在Linux上部署100%。

We have a few (less than 6) differences in the unit tests that are Windows-specific. 我们在Windows特定的单元测试中有一些(少于6个)差异。

The application has no changes. 该应用程序没有任何变化。 It works with Apache or not. 它适用于Apache或不适用。 It works with SQLite or MySQL. 它适用于SQLite或MySQL。

I've been working Py on both Windows and Linux. 我一直在Windows和Linux上工作Py。 I favor Linux because of several things: 我赞成Linux因为有几件事:

  1. virtualenvs - once you start working with virtualenvs, there is no turning back. virtualenvs - 一旦你开始使用virtualenvs,就没有回头路了。
  2. SHELL - CMD is very frustrating when executing python/management commands in django. SHELL - 在django中执行python /管理命令时,CMD非常令人沮丧。 Also, you should add python.exe every time :). 此外,你应该每次添加python.exe :)。
  3. ipython works better on Linux. ipython在Linux上运行得更好。
  4. GeoDjango doesn't work on Vista/7 last time i checked. 我上次检查时,GeoDjango无法在Vista / 7上运行。 I spent 3 days trying to set it up. 我花了3天时间尝试设置它。 Just for comparison, i set GeoDjango-able development environment in 20 minutes in Linux. 为了比较,我在Linux中在20分钟内设置了GeoDjango-able开发环境。
  5. Linux is free :) Linux是免费的:)
  6. Although there is no visible performance impact or incompatibility when working python cross-platform, the benefits of Linux for python development outweigh Windows by a lot. 虽然在使用python跨平台时没有明显的性能影响或不兼容性,但Linux对python开发的好处远远超过了Windows。 It's a lot more comfortable and definitely will boost your productivity. 它更加舒适,绝对会提高您的工作效率。
  7. ... ...

IMHO Linux is the smart choice for Python development. 恕我直言Linux是Python开发的明智选择。

Python program is very easily portable. Python程序非常容易移植。 Most of the time your code will work on any platform that have the appropriate version of python. 大多数情况下,您的代码可以在任何具有适当版本的python的平台上运行。

One point to be aware of though, is file path handling. 但需要注意的一点是文件路径处理。 Linux, Windows, Macs, etc uses different path schemes, so you shouldn't be handling them as strings; Linux,Windows,Mac等使用不同的路径方案,因此您不应将它们作为字符串处理; instead use os.path functions to join, split, etc. 而是使用os.path函数来连接,拆分等。

There is ultimately some slight performance difference with regard to timing, threading, processing, I/O, but they're nothing to worry about. 在时序,线程,处理,I / O方面,最终会有一些轻微的性能差异,但它们无需担心。

Integrating Python and C++ is easy; 集成Python和C ++很容易; the only problem is in the C++ side, ie you will have to recompile the C++ code. 唯一的问题是在C ++方面,即你将不得不重新编译C ++代码。

Shouldn't be a problem. 应该不是问题。 Some people even host Python+Django on Windows. 有些人甚至在Windows上托管Python + Django。

  1. Which software are you affraid will not work on windows, the actual web app or your development enviroment. 您害怕哪些软件无法在Windows,实际的Web应用程序或您的开发环境中运行。 If you mean the IDE, then I wouldn't worry about that there are very good python IDEs for windows, as for the webapp that's another discussion all together 如果你的意思是IDE,那么我不担心有非常好的用于Windows的python IDE,因为webapp是另一个讨论所有在一起

  2. The statement that "it is very easy integrating C++ libs with python" is not accurate, there are many ways of doing it and they are not all easy, I have personally only tried SWIG, but there are many other alternatives (for example Boost.Python), whoever I wouldn't believe it is as easy to get up and running with some of these tools on a windows enviromeny with out something like mingw or cygwin as at least SWIG is built with *nix in mind “很容易将C ++库与python集成”的说法并不准确,有很多方法可以做到并且它们并不容易,我个人只尝试过SWIG,但还有许多其他选择(例如Boost。 Python),无论我是谁都不相信它就像在mingw或cygwin之类的东西上使用这些工具一样容易起来和运行,因为至少SWIG是用* nix构建的

No. Unfortunately, linux is not a stable operating system (and never really has been).不。不幸的是,linux 不是一个稳定的操作系统(而且从来没有真正稳定过)。 You can expect to spend up to 2 hours each day maintaining the filesystem and fixing bugs that are endemic to linux or the packaging software of your distro of choice.您预计每天最多花费 2 小时来维护文件系统并修复 linux 或您选择的发行版的打包软件特有的错误。 Windows and mac are rock-solid and you may expect to create rock-solid apps in any language. Windows 和 mac 是坚如磐石的,您可能希望用任何语言创建坚如磐石的应用程序。 Your employer is much more likely to ask "Do you know Windows Server?"你的雇主更有可能问“你知道 Windows 服务器吗?” because linux is no longer the first choice of server software.因为linux已经不是服务器软件的首选了。 Companies don't care if you know linux (or Xenix or Citrix or embedded DOS) because few of them use it anyway.公司不在乎您是否知道 linux(或 Xenix、Citrix 或嵌入式 DOS),因为无论如何他们中很少有人使用它。 If you want to learn python, learn python. Development is fairly machine dependent.如果您想学习 python,请学习 python。开发相当依赖于机器。 You cannot make iOS or Swift apps on linux and you cannot make Windows apps on a Mac.您不能在 linux 上制作 iOS 或 Swift 应用程序,也不能在 Mac 上制作 Windows 应用程序。 If you want a job, learn job skills that people will pay money for.如果你想要一份工作,学习人们愿意付钱的工作技能。 Linux is a side hobby and will not influence your hireability. Linux 是一种业余爱好,不会影响您的就业能力。

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

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