正确地在OS X Lion上安装和配置Python / Pyside / PyDev(以及可能的未来版本的OS X) [英] Correctly Installing and configuring Python/Pyside/PyDev on OS X Lion (and likely future versions of OS X)

查看:173
本文介绍了正确地在OS X Lion上安装和配置Python / Pyside / PyDev(以及可能的未来版本的OS X)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有PyDev没有正确自动完成pyside的问题,我怀疑我在安装过程中缺少关键的一步。



那么,如何安装和配置新的OS X Lion安装来开发pyside?

注意:此问题不属于另一个堆栈站点。这是一个程序员必须做的,以使他的机器的形状开发python PySide使用PyDev。系统管理员不太可能遇到这个具体问题。

解决方案

我怀疑你遵循各种分散的文档,混合不同的python口译和python工具。下面的步骤4也需要做,这不是很多指南。



要使系统处于PySide开发状态,符合linux发行版,其中所有管道对齐默认情况下您必须执行以下步骤:



步骤1:安装Xcode,brew和xcode命令行工具(您将在酿造网站)。一旦您下载并安装了Xcode和命令行工具,以下命令行应该安装brew。

  / usr / bin / ruby​​  - e$(/ usr / bin / curl -fsSL https://raw.github.com/mxcl/homebrew/master/Library/Contributions/install_homebrew.rb)

检查一切都可以用酿造医生



使用文本编辑器将用户安装的二进制文件的路径添加到〜/ .profile / etc / paths export PATH = / usr / local / bin:$ PATH )。确保新路径在 $ PATH 之前(或 / etc / paths 的顶部,而不是之后)



此外,安装后,您需要确保您使用的任何python管理实用程序从正确的目录中获取。为此,将 / usr / local / share / python 添加到上面指定的新路径旁边的路径。这很重要,因为您希望easy_install正常运行并安装到您的python版本,而不是sox版本,下面我们验证正确的项目正在被拾取。



步骤2:使用brew安装python2.7。*

  brew install readline sqlite gdbm pkg-config 
brew install python - 框架 - universal

步骤3:验证python二进制文件和easy_install二进制文件是否正确目录。您可以使用 执行此操作而不是 whereis



步骤4:由于OSX具有框架的时髦概念,对于图书馆管理,我们必须符号链接的东西,以便其他工具(如eclipse)可以自动配置。

  cd /Library/Frameworks/Python.framework/Versions 
sudo rm当前
sudo ln -s /usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/Current
#following可能不需要或建议(参见下面的讨论)。
cd /System/Library/Frameworks/Python.framework/Versions
sudo rm当前
sudo ln -s /usr/local/Cellar/python/2.7.3/Frameworks/Python.framework /版本/当前

步骤5:使用brew安装pyside( brew install pydev )。这也安装Qt4作为依赖。



步骤6:安装Eclipse和PyDev



步骤7:配置eclipse。不要自动配置,手动添加一个新的解释器,并提供 / usr / local / bin / python 作为python路径。它应该自动拾取库。另外添加 PySide 到内置,因为PySide自动完成需要活跃的内省,而不是静态代码分析。



步骤8:安装pip easy_install install pip



如果您使用 pip brew 为了获得更多的Python代码,你应该将事物管道放入正确的目录。那是直到山狮来临,毁了你的一天:D



自我注释



我现在知道,与Windows .net或C / C ++(CRT)GAC或Linux的soname或java的类路径相比,依赖管理并不容易。我们都以一种迷茫的方式结束了。


I am having issues with PyDev not auto completing pyside correctly, I suspect that I am missing a crucial step in the installation process.

So, How does one install and configure a fresh OS X lion install to develop pyside ?

Note: This Question does NOT belong on another stack site. This is what a programmer has to do to get his machine in shape to develop python PySide using PyDev. A system administrator is unlikely to have encountered this specific issue.

解决方案

I suspect you followed the various scattered documentation around and mixed different python interpreters and python tools. Also Step 4 below needs to also be done, which not many guides mention.

To get the system in a state for PySide development in line with a linux distro, where all the plumbing aligns by default you have to do the following steps:

Step 1 : install Xcode, brew, and xcode command line tools (you will find documentation for this on the brew website). Once you have Xcode and command line tools downloaded and installed the following command line should install brew.

/usr/bin/ruby -e "$(/usr/bin/curl -fsSL https://raw.github.com/mxcl/homebrew/master/Library/Contributions/install_homebrew.rb)"

Check everything is OK with brew doctor.

add the path for user installed binaries to ~/.profile or /etc/paths with a text editor (export PATH=/usr/local/bin:$PATH). Make sure the new path is before the $PATH (or at the top of /etc/paths and not after).

Also, after install you want to make sure any python admin utilities that you use are picked up from the correct directory. For this add /usr/local/share/python to the path next to the new path you specified above. This is important because you want easy_install to be correctly functioning and installing to your version of python and not sox's, below we verify that the correct items are being picked up.

Step 2: Use brew to install python2.7.*

brew install readline sqlite gdbm pkg-config
brew install python --framework --universal

Step 3: verify the python binary and the easy_install binary are in the correct directories. You do this by using which and not whereis.

Step 4: Since OSX has the funky notion of frameworks, for library management, we have to symlink things so that other tools (such as eclipse) can auto config correctly.

cd /Library/Frameworks/Python.framework/Versions
sudo rm Current
sudo ln -s /usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/Current
# following might not be needed or advised (see discussion below).
cd /System/Library/Frameworks/Python.framework/Versions
sudo rm Current
sudo ln -s /usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/Current

Step 5: Install pyside using brew (brew install pydev). This also installs Qt4 as a dependency.

Step 6: Install Eclipse along with PyDev

Step 7: Configure eclipse. Do not auto configure, manually add a new interpreter and supply /usr/local/bin/python as the python path. It should pick up the libraries automatically. Also add PySide to the built-ins, since PySide autocompletion requires active introspection, rather than static code analysis.

Step 8: install pip easy_install install pip

Provided you use pip or brew for getting further python code, you should get things piping into the correct directories. That is till mountain lion comes along and ruins your day :D

note to self

I Know now that dependency management is no easier in python compared to windows .net or C/C++ (CRT) GAC or Linux's soname's or java's class path. We all end of with a maze of indirections.

这篇关于正确地在OS X Lion上安装和配置Python / Pyside / PyDev(以及可能的未来版本的OS X)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆