在 Vagrant 中运行 Python 脚本 [英] Run Python script in Vagrant

查看:49
本文介绍了在 Vagrant 中运行 Python 脚本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是一个愚蠢的问题,但请帮助我.

This is a dumb question but please help me.

问.如何运行保存在本地机器中的 Python 脚本?

Q. How do I run Python script that is saved in my local machine?

vagrant upvagrant ssh 之后,我在VM 中没有看到任何Python 文件.那么如果我想运行保存在我的 Mac 中的 Python 脚本怎么办?我不想使用 vim 手动复制和粘贴它们.

after vagrant up and vagrant ssh, I do not see any Python file in the VM. Then what if I want to run Python scripts that are saved in my Mac? I do not want to copy and paste them manually using vim.

你会如何在 Vagrant ssh 中运行 Python 脚本?

How would you run Python script in Vagrant ssh?

推荐答案

在您的客户操作系统上,/ 下将有一个文件夹,名为 /vagrant/ 这就是全部host 机器上包含 .VagrantFile

On your Guest OS there will be a folder under / called /vagrant/ this will be all the files and directories under the directory on your host machine that contains the .VagrantFile

如果您将脚本放在该文件夹中,它们将与虚拟机共享.

If you put your script in that folder they will be shared with the VM.

此外,如果您使用 chef 作为您的供应商,您可以使用 script 资源在供应步骤中运行外部脚本.

Additionally if you are using chef as your provisioner you can use a script resource to run external scripts during the provisioning step.

这篇关于在 Vagrant 中运行 Python 脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆