“python:无法打开文件”manage.py“:[Errno 2]没有这样的文件或目录”运行tmux shell脚本时? [英] "python: can't open file 'manage.py': [Errno 2] No such file or directory" when running tmux shell script?
问题描述
我正在尝试运行一个非常简单的tmux shell脚本,名为split.sh,它分割终端窗口。
I am trying to run a very simple tmux shell script called "split.sh" which splits the terminal windows.
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脚本运行正常,分割终端窗口。
When I type the command "sh ~/build/tmux-1.5/split.sh", this shell script runs fine, splitting the terminal windows.
然而,当我设置一个别名时,
However, when I set an aliases,
alias sp='sh ~/build/tmux-1.5/split.sh'
然后运行sp,终端给我一个wierd错误:
and then run "sp", the terminal gives me a wierd error:
python: can't open file 'manage.py': [Errno 2] No such file
我相信这个错误与manage.py有关的Django ..但我不知道为什么终端寻找管理。 PY。为什么终端给我这个错误:(?
I believe this error with "manage.py" has something to do with Django.. but I have no idea why terminal is looking for manage.py. Why is the terminal giving me this error :(???
谢谢。
推荐答案
我遇到了同样的问题, manage.py 在目录中,但仍然遇到这个问题。
I faced the same problem. 'manage.py' was in the directory but still was having this issue.
python:无法打开文件'manage.py':[Errno 2]没有这样的文件或目录
python: can't open file 'manage.py': [Errno 2] No such file or directory
我所做的是提到manage.py所在的项目的完整路径,这样就可以成功运行命令!这是因为该文件位于子目录中,您需要输入相应的子目录或将其添加到文件名正如我下面
What I did was that mentioned complete path to the project where manage.py was located like this and ran the command successfully! it's because the file was located in a subdirectory. You need to either enter the appropriate subdirectory or add it to the filename as I did below
python C:\Users\myuser\python_projects\myproject\manage.py syncdb
希望这将有助于您解决问题。
Hopefully that will help you to resolve the issue.
这篇关于“python:无法打开文件”manage.py“:[Errno 2]没有这样的文件或目录”运行tmux shell脚本时?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!