启动SublimeREPL -python时,发生“没有这样的文件或目录"错误 [英] “ No such file or directory” error happens when start SublimeREPL -python
问题描述
每次我在sublimeREPL软件包中启动python时,它都会给我错误,已经有一个讨论此错误的分支,而官方文档提供了以下解决方案
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"}
...
}
我已经更改了python解释器的安装路径,例如
I have changed the path to where the python interpreter is installed,say
{
"default_extend_env": {"PATH": "{PATH}:\\Python34"}
}
但是似乎不正确,所以我应该输入哪个路径名,python解释器路径还是sublimeREPL的路径?我该如何找到路径?谢谢
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
推荐答案
您需要编辑SublimeREPL配置文件之一以指向C:\Python34\python.exe
.不过,首先,您应该将C:\Python34
添加到系统的PATH
变量中-如果您不知道如何将其添加到Google上.如果这不起作用(在重新启动Sublime Text之后),请执行以下操作:
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:
通过选择 Preferences -> Browse Packages...
打开Packages
文件夹.在Windows资源管理器中打开Packages
后,请依次打开SublimeREPL
文件夹,config
文件夹,Python
文件夹,然后在Sublime中打开Main.sublime-menu
(使用JSON语法突出显示).现在,在您看到"cmd"
选项的任何位置,在以下方括号内,将"python"
替换为"c:/python34/python.exe"
(请记住,使用正斜杠/
作为路径定界符).所以,这个:
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"],
应更改为:
"cmd": ["c:/python34/python.exe", "-u", "$file_basename"],
在带有"caption": "Python - IPython"
的部分中,仅更改"cmd"
字典中以"windows"
开头的行(第71行).因此,总而言之,您应该更改第22、39、53和71行.完成后保存文件,重新启动Sublime,SublimeREPL现在应该可以在Python 3.4上使用
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
这篇关于启动SublimeREPL -python时,发生“没有这样的文件或目录"错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!