如何安装 Mathematica 新软件包?
为 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
要让您下载或亲自创建的包对 Mathematica 可见,请将它们放入
$UserBaseDirectory/Applications
中,如果您希望它们可以被访问,则将它们放入$BaseDirectory/Applications
中。您系统上的所有用户。或者,版本 8.0.4(可能更早)有一个菜单选项:文件 -> 安装它将为您完成它。菜单选项会弹出以下对话框其中选项“安装用于仅此用户(名称)”将其安装在
$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 dialogwhere 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.
如果它们只是临时包,则从当前目录加载它们通常更容易,但否则将文件移动到
$Path
上的任何位置(例如$UserBaseDirectory/Applications
正如 rcollyer 所建议的那样)尽管某些目录是自动加载的,但仍然可以工作。我通常的解决方案是
在所有笔记本中或多或少都有第一行。然后我可以使用
Needs["foo
"]` 从笔记本目录加载包。对于版本控制,您可以使用更详细的需求形式: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
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:在 Windows 下,通常最好使用
%AllUsersProfile%
目录而不是%UserProfile%
来存储其他包。 以下命令给出了Windows下相应目录的路径: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:P.S. I think this and this answers of John Fultz are relevant.