即使重新安装Ocaml(Mac OS X)也无法获取图形? [英] Not getting graphics even when reinstalled Ocaml (Mac OS X)?

查看:116
本文介绍了即使重新安装Ocaml(Mac OS X)也无法获取图形?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

此帖子之后,我安装了brew,然后重新安装了ocaml以包括图形:

Following this post I installed brew and then reinstalled ocaml to include graphics:

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

brew cask install xquartz
brew reinstall ocaml --with-x11

但是重新启动计算机后,当我尝试运行使用图形的ocaml程序时出现错误

But after restarting my computer, when I tried to run an ocaml program that used graphics I got the error

Error: Cannot find file /Users/.../.opam/4.03.0/lib/ocaml/graphics.cma

帖子还说:

最后记得检查一下正在运行的ocaml实例 是/usr/local/Cellar/objective-caml/x.yy.z[_w]/bin中的一个,并且 如果不是,则将该URL放在您的PATH环境中 变量.

Finally remember to check that the instance of ocaml that is running is the one in /usr/local/Cellar/objective-caml/x.yy.z[_w]/bin, and if it isn't then prepend that url to your PATH environment variable.

如何检查正在运行的ocaml实例?张贴者所说的将该URL前缀到您的PATH环境中"是什么意思?

How do I do check the instance of ocaml that is running? And what does the poster mean by "prepending that url to your PATH environment"?

我尝试将目录更改为该路径,但出现错误:

I've tried changing my directory to that path, but I get an error:

$ cd /usr/local/Cellar/objective-caml/
-bash: cd: /usr/local/Cellar/objective-caml/: No such file or directory

如果有人可以告诉我,要使graphics.cma正常工作,我需要做些什么!

If someone could please tell me what I need to do to get graphics.cma working that would be great!

我尝试创建.bashrc并放入

alias ocaml="/usr/local/Cellar/ocaml/4.04.0/bin/ocaml"

但仍然无济于事...我对如何做完全迷失了.如果有人可以告诉我该怎么做,那太好了!

Yet with no avail...I'm quite lost on what to do. If anyone could give me an inkling of what to do that would be great!

(注意:我在浏览目录/usr/local/Cellar/ocaml/4.03.0/bin/ocaml时放了而不是4.03.0,但是目录/usr/local/Cellar/ocaml/4.04.0/bin/ocaml确实放了)

(Note: I put 4.04.0 instead of 4.03.0because when I explored the directory /usr/local/Cellar/ocaml/4.03.0/bin/ocaml but the directory /usr/local/Cellar/ocaml/4.04.0/bin/ocaml does)

推荐答案

如何检查正在运行的ocaml实例?

How do I do check the instance of ocaml that is running?

如果您的问题是:在shell提示符下的终端窗口中键入ocaml时,正在运行什么程序(或更常见的情况是通过

If your question is: what program is running when you type ocaml in a terminal window at the shell prompt (or more generally thru execvp and other functions)? then you should use the which ocaml command.

发布者所说的在PATH环境中添加该网址"是什么意思?

And what does the poster mean by "prepending that url to your PATH environment"?

详细了解 PATH 变量.它通常是在您的 ~/.bashrc文件中设置的(您可能应该仔细编辑一次使用您喜欢的编辑器)-或其他一些bash初始化文件-如果您的交互式shell是bash.您应该使用echo $PATH命令检查它的含义.另请参见.请注意,~/.bashrc扩展 Bash启动文件一章.

Read more about the PATH variable. It is often set in your ~/.bashrc file (which you should probably and carefully edit once using your favorite editor) -or some other bash initialization file- if your interactive shell is bash. You should check what it is with the echo $PATH command. See also this. Notice that ~/.bashrc is expanded by your shell during globbing. Read also the documentation of bash notably the Bash Startup Files chapter.

如果使用的是opam,则应阅读其文档.值得注意的是,此问题(在其常见问题解答中提及了PATH).

If you are using opam you should read its documentation. Notably this question (mentioning PATH) from its FAQ.

由于别名主要用于交互式shell,因此对于大多数shell脚本而言,仅定义别名是不够的.您确实需要更改您的$PATH和/或在其中提到的目录中添加文件(或符号链接).

Since aliases are mostly for interactive shells, defining an alias is not enough for most shell scripts. You really need to change your $PATH and/or add files (or symlinks) in directories mentioned in it.

PS.认真使用PATH的角色以及如何设置PATH是强制使用命令行的必要条件,尤其是在POSIX系统上.

PS. Understanding the role of PATH and how to set it is mandatory for serious use of the command line, notably on POSIX systems.

这篇关于即使重新安装Ocaml(Mac OS X)也无法获取图形?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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