[英]Python installation in Mac OS X virtual environment that includes a framework that I can include into Xcode?
I like to use Python with numpy, scipy and some other packages. 我喜欢将Python与numpy,scipy和其他一些软件包一起使用。 I am an absolute Python beginner and have some issues with the installation under Mac OS X.
我是绝对的Python初学者,在Mac OS X下安装时遇到一些问题。
I am following these two tutorials to install python: 1 and 2 . 我正在按照这两个教程安装python: 1和2 。
Here, HomeBrew is used to install Python (with pip) and virtualenv. 在这里,HomeBrew用于安装Python(带有pip)和virtualenv。 I do not have an opinion about what is better, MacPorts, HomeBrew, Fink... I just found this tutorial inspiring confidence.
我对MacPorts,HomeBrew,Fink哪个更好没有意见……我只是发现本教程激发了人们的信心。
If I understand things correctly, OS X system Python, which I should never touch, is under /System/Library/Frameworks/Python.Framework. 如果我理解正确,那么我永远都不会碰的OS X系统Python位于/System/Library/Frameworks/Python.Framework下。 And I cannot use this one in Xcode because it does not have my wanted packages.
而且我不能在Xcode中使用此代码,因为它没有我想要的软件包。 The HomeBrew Python will be installed somewhere in /usr/local/.
HomeBrew Python将安装在/ usr / local /中的某个位置。 I found a framework there but as the system framework it does not have the additional packages.
我在那里找到了一个框架,但是作为系统框架,它没有附加的程序包。 The tutorial explains that it might be better to install additional packages in virtual environments only which is done via pip.
本教程说明,最好仅在虚拟环境中通过pip安装其他软件包。 But I cannot find a framework there.
但是我在那里找不到框架。
So my question is: How can I get a Python installation in a virtual environment that includes a framework that I can include into Xcode? 所以我的问题是:如何在虚拟环境中安装Python,并将其包含在Xcode中?
But if you want, you can install others versions of Python (in 64-bits, not 32 !): 但是,如果您愿意,可以安装其他版本的Python(64位而不是32位!):
a) the way prescribed by Apple: as a framework a)苹果规定的方式:作为框架
You must change the PATH of the Python executable in /usr/bin (usually, this is done automatically by the distribution by symlinks or in the /Users/me/.bash_profile file ). 您必须在/ usr / bin中更改Python可执行文件的PATH(通常,这是通过符号链接的分发或/Users/me/.bash_profile文件自动完成的)。
The modules installed in /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages do not interfere with those installed in /Library/Python/2.7/site-packages if you use the appropriate Python executable and viceversa. 安装在/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages的模块不与安装在/Library/Python/2.7/site-packages这些干扰,如果你使用适当的Python可执行程序反之亦然。
b) the package management system way b)包裹管理系统方式
MacPorts install its own version of Python in the folder /opt/ ; MacPorts在文件夹/ opt /中安装自己的Python版本。
sudo port -v install python27 须藤端口-v安装python27
Fink install its own version of Python in the folder /sw/ ; Fink在/ sw /文件夹中安装自己的Python版本。
fink install Python27 芬克安装Python27
Homebrew installs Python in /usr/local/Cellar with symlinks in /usr/local/bin . Homebrew在/ usr / local / bin中通过符号链接在/ usr / local / Cellar中安装Python。
brew install python brew安装python
or 要么
brew install python --framework brew安装python --framework
To use them, you must add /sw/bin, /sw/lib/ or /opt/bin, /opt/lib/ to the PATH and change the PATH of the Python executable 要使用它们,必须将/ sw / bin,/ sw / lib /或/ opt / bin,/ opt / lib /添加到PATH并更改Python可执行文件的PATH
c) the "autonomous" way c)“自主”方式
d) the "hard" way d)“硬性”方式
So your question: 所以你的问题是:
How can I get a Python installation in a virtual environment that includes a framework that I can include into Xcode?
我如何在虚拟环境中安装Python,该虚拟环境包括可以包含在Xcode中的框架?
Unless you are a Unix specialist (PATHs management) , you must use the Apple's recommended solution, a frameworks distribution (including the Apple Python) 除非您是Unix专家(PATHs管理),否则必须使用Apple推荐的解决方案,框架发行版(包括Apple Python)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.