![](/img/trans.png)
[英]SSHed into my Vagrant virtual machine to run a python script…but the python script doesn't work unless I'm in the VM itself
[英]I'm learning how to use Vagrant and I was trying to run a python script
在GitBash上我跑了
vagrant up
vagrant ssh
Python abc.py
它给出了一个错误
/usr/bin/env: ‘python\r’: No such file or directory
我试过dos2unix
命令它dos2unix
python版本:
Python 2.7.12+
如何通过此错误消息?
确保你的%USERPROFILE%\\.bashrc
为你的PATH添加了python
路径
export PATH=/c/path/to/Python:$PATH
然后再次启动bash,看看错误是否仍然存在。
如果vagrant ssh使用不同的bash资源文件,请键入(在相同的bash“ vagrant ssh
”会话中)
echo export PATH=/c/path/to/Python:\$PATH >> ~/.bashrc
source ~/.bashrc
然后再试一次Python abc.py
'蟒蛇\\ r':
你已经搞砸了你的python脚本中的行结尾。 与vagrant无关,而是你用来编写代码的东西。
在ssh会话中打开vim并修复行结尾
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.