【问题标题】:"python: can't open file 'manage.py': [Errno 2] No such file or directory" when running tmux shell script?“python:无法打开文件'manage.py':[Errno 2]没有这样的文件或目录”运行tmux shell脚本时?
【发布时间】:2013-06-19 02:25:01
【问题描述】:

我正在尝试运行一个名为“split.sh”的非常简单的 tmux shell 脚本,它可以拆分终端窗口。

split.sh:

#!/bin/bash
~/build/tmux-1.5/tmux split-window -h
~/build/tmux-1.5/tmux split-window -v
~/build/tmux-1.5/tmux split-window -h

当我输入命令“sh ~/build/tmux-1.5/split.sh”时,这个shell脚本运行良好,分割终端窗口。

但是,当我设置别名时,

alias sp='sh ~/build/tmux-1.5/split.sh'

然后运行“sp”,终端给我一个奇怪的错误:

python: can't open file 'manage.py': [Errno 2] No such file

我相信“manage.py”的这个错误与 Django.. 但我不知道为什么终端正在寻找 manage.py。为什么终端给我这个错误:(???

谢谢。

【问题讨论】:

  • type sp 说什么?
  • 大概在每个 tmux 窗口中都会启动一个新的 shell - 你的 .bashrc 中有什么(或你运行的 shell 的等价物)?

标签: linux django shell terminal tmux


【解决方案1】:

我遇到了同样的问题。 'manage.py' 在目录中,但仍然存在此问题。

python: 无法打开文件 'manage.py': [Errno 2] 没有这样的文件或目录

我所做的是提到了manage.py所在项目的完整路径,并成功运行了命令!这是因为该文件位于子目录中。您需要输入适当的子目录或将其添加到文件名中,如下所示

python C:\Users\myuser\python_projects\myproject\manage.py syncdb

希望这能帮助您解决问题。

【讨论】:

    猜你喜欢
    • 2019-10-24
    • 1970-01-01
    • 2017-12-11
    • 1970-01-01
    • 2019-12-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多