如何安装 Mathematica 新软件包?

发布于 2024-10-11 00:32:23 字数 320 浏览 1 评论 0原文

为 Mathematica 安装新软件包的正确步骤是什么?

特别是,当您从 MathWorld 下载任何笔记本时,您将获得一个< a href="http://library.wolfram.com/infocenter/MathSource/4775" rel="noreferrer">链接到 Mathworld 包,这是包含数十个 .m 文件的 zip 文件

它们去哪里?

What is the proper procedure way to install new packages for Mathematica?

In particular, when you download any notebook from MathWorld, you are are given a link to Mathworld packages, which is are zip files with dozens of .m files

Where do they go?

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

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

发布评论

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

评论(3

苏别ゝ 2024-10-18 00:32:23

要让您下载或亲自创建的包对 Mathematica 可见,请将它们放入 $UserBaseDirectory/Applications 中,如果您希望它们可以被访问,则将它们放入 $BaseDirectory/Applications 中。您系统上的所有用户。或者,版本 8.0.4(可能更早)有一个菜单选项:文件 -> 安装它将为您完成它。菜单选项会弹出以下对话框

installdialog

显示安装类型下拉列表

显示项目源下拉列表

其中选项“安装用于仅此用户(名称)”将其安装在 $UserBaseDirectory 下,“对于所有用户”选项将其安装在 $BaseDirectory 下。

有关 Mathematica 放置所有内容的更多信息,我将阅读此 教程< /a>,并查看目录操作功能

To have your packages that you've either downloaded or personally created visible to Mathematica, put them in $UserBaseDirectory/Applications, or $BaseDirectory/Applications if you want them accessible to all users on your system. Alternatively, version 8.0.4 (and likely earlier) has a menu option: File -> Install which will do it for you. The menu option brings up the following dialog

install dialog

install type drop-down displayed

item source drop-down displayed

where the option "Install for this user only (name)" would install it under $UserBaseDirectory and the "for all users" option would install it under $BaseDirectory.

For more information on where Mathematica places everything I would read this tutorial, and look through directory operations functionality.

删除会话 2024-10-18 00:32:23

如果它们只是临时包,则从当前目录加载它们通常更容易,但否则将文件移动到 $Path 上的任何位置(例如 $UserBaseDirectory/Applications正如 rcollyer 所建议的那样)尽管某些目录是自动加载的,但仍然可以工作。

我通常的解决方案是

SetDirectory[NotebookDirectory[]]

在所有笔记本中或多或少都有第一行。然后我可以使用 Needs["foo"]` 从笔记本目录加载包。对于版本控制,您可以使用更详细的需求形式:

Needs["foo`","foo-001.m"] 

If they are just temporary packages, it is often easier to load them from the current directory, but otherwise moving the files to anywhere on $Path (such as $UserBaseDirectory/Applications as suggested by rcollyer) will work although some directories are autoloaded.

My usual solution is to have

SetDirectory[NotebookDirectory[]]

as more or less the first line in all notebooks. I can then load packages from the notebook directory with Needs["foo"]`. For versioning, you can use the more verbose form of needs:

Needs["foo`","foo-001.m"] 
荭秂 2024-10-18 00:32:23

在 Windows 下,通常最好使用 %AllUsersProfile% 目录而不是 %UserProfile% 来存储其他包。 以下命令给出了Windows下相应目录的路径:

First@ReadList["!cmd /C echo %AllUsersProfile%", 
   String] <> "\\Application Data\\Mathematica\\Applications"

PS我认为< a href="https://groups.google.com/group/comp.soft-sys.math.mathematica/msg/06fb7390bc9e8a17?hl=ru" rel="nofollow">此 和 约翰·富尔茨的这个答案是相关的。

Under Windows it is often better to use %AllUsersProfile% directory instead of %UserProfile% for storing additional packages. The following command gives the path to the corresponding directory under Windows:

First@ReadList["!cmd /C echo %AllUsersProfile%", 
   String] <> "\\Application Data\\Mathematica\\Applications"

P.S. I think this and this answers of John Fultz are relevant.

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