“ No such file or directory” error happens when st

2019-02-28 01:54发布

Everytime I start the python within sublimeREPL package, it gives me the error,there has already been a branch of discussion of this error,and the offical document gives the following solution

    "If the binary is not in your system path and you can’t or won’t change that, tweak SublimeREPL configuration:"
{
...
"default_extend_env": {"PATH": "{PATH}:/home/myusername/bin"}
...
 } 

I have changed the path to where the python interpreter is installed,say

    {

"default_extend_env": {"PATH": "{PATH}:\\Python34"}

    }

But it seems not correct, so which path name should I enter, the python interpreter path or sublimeREPL's path? And how can I find the path?Thank you

2条回答
一夜七次
2楼-- · 2019-02-28 02:12

Another option is to solve this issue using symlinks. Because I am lazy and didn't want to figure out all of the places that I might need to change settings within Sublime, I just created a symbolic link between where Sublime REPL thought that the executable should be and where it actually was - that way, when Sublime REPL looks to where it thinks the executable will be the symbolic link will automatically point it in the right direction.

At least for me, this error was accompanied by a message saying where Sublime REPL had tried, unsuccessfully, to locate the python executable (in my case, Sublime REPL had tried finding it in /Users/Ohlrogge/anaconda/bin/). To find where the executable actually was, I used ran the following command from the terminal:

which python

This then gave me the directory the python executable is in (in this case it was, for me, /anaconda/bin/. Then, I just entered into the terminal:

ln -s /anaconda/bin/python /Users/Ohlrogge/anaconda/bin/python

in order to create the symbolic link. Note the general syntax for ln command, which will work in linux or osx, is:

ln -s [/path/to/original] [/path/to/symlink]

In Windows systems, it is similar, but the order of the arguments is reversed:

mklink [path\to\link] [path\to\original]

See here for more on linking in windows.

查看更多
趁早两清
3楼-- · 2019-02-28 02:30

You'll need to edit one of the SublimeREPL config files to point to C:\Python34\python.exe. First of all, though, you should add C:\Python34 to your system's PATH variable - google it if you don't know how. If that doesn't work (after restarting Sublime Text), do the following:

Open your Packages folder by selecting Preferences -> Browse Packages.... Once Packages opens in Windows Explorer, open the SublimeREPL folder, then the config folder, then the Python folder, then open Main.sublime-menu in Sublime (use JSON syntax highlighting). Now, anywhere you see a "cmd" option, inside the following brackets replace "python" with "c:/python34/python.exe" (remember to use forward slashes / as the path delimiters). So, this:

"cmd": ["python", "-u", "$file_basename"],

should be changed to:

"cmd": ["c:/python34/python.exe", "-u", "$file_basename"],

In the section with "caption": "Python - IPython", only alter the line in the "cmd" dict starting with "windows" (line 71). So, all in all, you should be altering lines 22, 39, 53, and 71. Save the file when you're done, restart Sublime, and SublimeREPL should now be working with Python 3.4

查看更多
登录 后发表回答