Python 开发设置
所以,我想开始认真的Python开发,事实证明这是一个很大的痛苦。我一点也不担心语言本身;我非常喜欢它,拿起它不会有任何问题。但生态系统让我发疯。
首先我尝试在windows下启动并运行。几天后我放弃了,因为 90% 的软件包不包含 Windows 支持/安装说明。所以我改用了macosx,人们说这对mac开发有好处。
更多的挫败感随之而来。我想使用 python 作为 matlab 替代品和工具开发平台,因此spyderlib 似乎是一个出色的工具。但现在我忙了两天在我的 mac 上构建 pyqt,但没有成功,我开始质疑这一切是否明智。显然,从字面上遵循几个指南总是会导致神秘的错误。此依赖项是为哪个平台构建的?需要设置哪些神秘的编译器标志?我不知道,也不关心;为什么安装程序不明白这一点?哦等等,没有……我想使用这些工具,而不是首先对它们进行完全逆向工程以找出如何构建它们。
在我能找到的关于这些问题的所有文档中,有大量隐含的知识,无论是关于 unix 还是 pythonic 的怪癖。有没有办法在一个学习曲线可控的地方攀登这座山?现在我不知道自己在做什么。或者我应该回到Windows并尝试强制我需要的unix软件包进行合作?
So, id like to start serious python development, and its proven to be a big pain. Im not worried at all about the language itself; I like it well enough and I will have no problems picking it up. But the ecosystem is driving me crazy.
First I tried to get up and running under windows. I gave up on that after a few days, as 90% of packages dont include windows support / install instructions. So I switched to macosx, which people said was good for mac development.
More frustration ensues. Id like to use python as a matlab replacement and tool development platform, so spyderlib seems like an excellent tool. But now ive been busy trying to build pyqt on my mac for two days, to no avail, and im starting to question the wisdom of it all. Obviously, following several guides literally invariantly ends in cryptic errors. For which platform was this dependency built? What arcane compiler flags need to be set? I dont know and I dont care; why doesnt the installer figure it out? Oh wait, there isnt any... I want to USE these tools, not first completely reverse engineer them to find out how to build them.
There is a vast amount of implied knowledge in all the documentation I can find on these matters, both with regard to unix and pythonic quirks. Is there any way to scale this mountain, in a place with a managable learning curve? Right now I have no idea what im doing. Or should I go back to windows and try to coerce the unix packages I need into cooperation?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
在 Mac OS X 上,您可以使用macports 获取spyder。这应该构建所需的一切。
如果您更喜欢 Windows,请查看 Python(x,y)。它有很多预先构建的科学工具,包括spyder。
最后,对于科学工作来说,Enthought Python 发行版值得考虑。
On Mac OS X, you can get spyder with macports. This should build everything needed.
If you prefer Windows, take a look at Python(x,y). It has a bunch of scientific tools pre-built, including spyder.
Finally, the Enthought Python distribution is worth considering for scientific work.
您是否尝试过ActivePython?
当您可以获得 预构建 软件包 来自 PyPM?
Have you tried ActivePython?
Why battle with compiling the modules yourself when you can get the pre-built packages from PyPM?
根据我的经验,对于您所描述的项目来说,最佳平台是 Linux。在那里,您只需从包管理器安装所需的库即可。二进制包,所以不需要编译。
如果您想坚持使用 MacOS X,则应该安装 MacPorts 或 Fink。通常很容易使用。问题是,像 Qt 这样的东西需要永远编译。但你不会经常这样做。
至于安装Python模块,最好的是PIP,它是
easy_install的非常好的替代品
确实做了更多的事情。如果您想要设置 virtualenv,则特别有用。From my experience the best platform for kind of project you're describing is Linux. There you just install the libs you need from package manager and that's it. Binary packages, so compiling is not required.
If you want to stick with MacOS X, you should install either MacPorts or Fink. It's usually easy to use. Problem is, that things like Qt take forever to compile. But you won't be doing that very often.
As for installing Python modules, the best is PIP, which is very nice replacement for
easy_install
did does much more. Especially useful if you wantvirtualenv
setup.这与我在 Windows 上使用 Python 的经历几乎完全相反。 Python 本身使用二进制安装程序进行安装,大多数附加软件包支持 easy_install,其他软件包则提供自己的二进制安装程序。我使用的 IDE 是 SciTE,它使用旧的 DOS 安装模型 - 将文件复制到目录并运行 SciTE.exe 文件。如果您获得 Python 包的源代码分发,请转到包含 setup.py 的目录并运行 python setup.py install。也许这就是你所说的隐含知识。
您还可以在 http://www.lfd.uci.edu/ 找到许多非官方 Windows 二进制文件~gohlke/pythonlibs/。
This is nearly the exact opposite of my experience with Python on Windows. Python itself installs with a binary installer, most add-on packages support easy_install, others provide binary installers of their own. The IDE I use is SciTE, which uses the old DOS install model - copy the files to a directory and run the SciTE.exe file. If you get a source distribution of a Python package, go to the directory containing
setup.py
and runpython setup.py install
. Maybe that's the implied knowledge you're talking about.You can also find many unofficial Windows binaries at http://www.lfd.uci.edu/~gohlke/pythonlibs/.
几年前,我切换到 Mac,发现我花了相当长的时间在谷歌上搜索才能正确安装 Python 开发所需的所有软件包。当我安装所有东西时,我列出了设置可能也适合您的功能系统所需的步骤。我通常将 NetCDF4、HDF5、Numpy、Matplotlib、f2py 和 Fortran 与 Python 结合使用。我在我的网站上发布了从源代码安装的 22 个设置步骤列表。从源代码安装比使用 macports 和 fink 更耗时,但可以让您拥有针对您的系统优化的工作环境。
I switched to Mac a few years ago and found that it took me quite a while of googling to properly install all the packages I needed for Python development. While I installed everything I made a list of the steps required to setup a functional system that may be appropriate for you as well. I usually use NetCDF4, HDF5, Numpy, Matplotlib, f2py, and Fortran in combination with Python. I published my list of 22 setup-steps for installing from source on my website. Installing from source is somewhat more time-consuming than using macports and fink, but enables you to have a working environment that is optimized for your system.