在 OS X 中创建包安装程序 - 安装 Python、NumPy 和其他依赖项

发布于 2025-01-03 20:56:01 字数 674 浏览 4 评论 0原文

我想创建一个本机 Mac OS X 软件包安装程序,软件包的创建并不是真正的问题,真正的问题是必须安装的依赖项;我需要安装 Python、NumPy 和 Matplotlib(仅当尚未安装所需版本时)。

我听说过有关 Package Maker 应用程序的非常糟糕的事情,我已经阅读了一些,甚至已经找到了一个很好的教程,尽管它相当 已过时。作为参考,这里是Apple的参考指南

我想我必须使用这三个项目中每个项目提供的未编译源代码。

查看用于创建官方 Python 安装程序的 PackageMaker 文件确实对我有帮助,如果此类文件在某处可用,请指出它。

无论如何:

最好的方法是什么?为此使用 PackageMaker 是否愚蠢?还有其他文献可以帮助我吗?

额外:

测试我的安装程序的最简单方法是什么?

I want to create a native Mac OS X package installer, the creation of the package is not really the problem, the real deal is the dependencies that have to get installed; I need to install Python, NumPy and Matplotlib (only if the required versions are not already installed).

I have heard really bad things about the Package Maker app, I've been reading a little and have already even found a nice tutorial although it is quite outdated. As a reference, here's Apple's reference guide.

I imagine I would have to use the uncompiled source provided from each of these three projects.

It would really help me to see the PackageMaker file that is used to create the official Python installer, if such file is available somewhere, please point me to it.

Anyway:

What would be the best way to do this? Is using a PackageMaker silly for this purpose? Any other literature that would help me?

Extra:

What would be the easiest way to test my installers?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

眼前雾蒙蒙 2025-01-10 20:56:01

我假设您想要安装您提到的软件包,因为您正在开发 Python 应用程序。您看过 PyInstaller 吗?它“在 Windows、Linux、Mac OS X、Solaris 和 AIX 下将 Python 程序转换(打包)为独立的可执行文件”,因此您不必担心目标系统上安装了什么。

如果您使用 PyInstaller,“额外”将很容易。只需将生成的可执行文件复制到任何其他计算机并通过执行来测试它。

I'm assuming that you want to install the packages that you mentioned because you are developing a Python application. Have you looked at PyInstaller? It "converts (packages) Python programs into stand-alone executables, under Windows, Linux, Mac OS X, Solaris and AIX", so you don't have to worry about what's installed on the target system.

And if you use PyInstaller, the "extra" would be easy. Simply copy the resulting executable to any other machine and test it out by executing it.

溺深海 2025-01-10 20:56:01

类似于 /tmp/install.sh

cd ~
curl -C - -O http://pypi.python.org/packages/source/v/virtualenv/virtualenv-1.7.tar.gz

tar -xzf virtualenv-1.7.tar.gz
cd ./virtualenv-1.7
python setup.py install

cd ~
rm virtualenv-1.7.tar.gz
rm -rd ./virtualenv-1.7

virtualenv myenvfolder
source myenvfolder/bin/activate
easy_install pip 

pip install NumPy
pip install Matplotlib

然后:

chmod +x /tmp/install.sh;
/tmp/install.sh

Something like /tmp/install.sh:

cd ~
curl -C - -O http://pypi.python.org/packages/source/v/virtualenv/virtualenv-1.7.tar.gz

tar -xzf virtualenv-1.7.tar.gz
cd ./virtualenv-1.7
python setup.py install

cd ~
rm virtualenv-1.7.tar.gz
rm -rd ./virtualenv-1.7

virtualenv myenvfolder
source myenvfolder/bin/activate
easy_install pip 

pip install NumPy
pip install Matplotlib

And then:

chmod +x /tmp/install.sh;
/tmp/install.sh
幻想少年梦 2025-01-10 20:56:01

也许你可以使用 macports binary-packages二进制存档
也许是fabric 或 puppet
OSX 上的 Puppet

Macports 使用起来就像 apt-get 一样简单,并且可以处理所有依赖关系。默认情况下,macports 安装到 /opt/local,因此安装不会干扰 Apple 安装。默认是从源代码编译。有些包很大并且有很多依赖项,因此编译需要花费大量时间和机器上的所有资源。如果您制作二进制存档,则只需编译 pr machine archithecture/osx-version 即可。然后你只需要安装 macports 并设置与二进制存档的共享。使用 Fabric 或 Puppet,您可以自动化构建和分发。

然后,如果您在不久的将来发现您需要 pytable 或 numexpr,那么就像这样简单: sudo port install py26-tables
如果其他人需要它,您可以对其进行二进制存档并将其放在共享上。

Maybe you can use macports binary-packages or binary-archives?
and maybe fabric or puppet.
Puppet on OSX.

Macports is as simple as apt-get to use and takes care of all dependencies. By default macports installs to /opt/local so installs don't interfere with apple installs. Default is to compile from source. Some packages are big and have a lot of dependencies so compiling takes a lot of time and all the recourse on the machine. If you make a binary-archive you only have to compile ones pr machine arcithecture/osx-version. Then you only need to install macports and sett up a share with binary-archives. With fabric or puppet you can automate builds and distribution.

Then if you in the near future find out that you need pytable or numexpr it is as simple as: sudo port install py26-tables
and if other people need it to you can make binary-archive of it and put it on the share.

蓝戈者 2025-01-10 20:56:01

要安装 Python 的最新版本,您可以访问此处,并且可以使用这些命令直接在终端中安装 NumPy 和 matplotlib :

pip3 install matplotlib

pip3 install numpy

To install Python's latest version you can go here, and you can install NumPy and matplotlib directly in your terminal with these commands:

pip3 install matplotlib

pip3 install numpy
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文