重现步骤:
- 在 linux 环境中,在桌面上创建一个名为“fab”的文件夹
- 仅供参考,我正在使用 zsh
- 光盘到
~/Desktop/fab
fabfile.py
通过发出以下命令在您的 ./fab 目录中运行它fab init
:#!/usr/bin/env python #set up ssh to remote server import sys, os, fileinput from fabric.api import * def init(): local('mkdir ./virtualenv') local('cd ./virtualenv && virtualenv --no-site-packages venv') local('chown -R user:user ./virtualenv/') local('chmod 770 -R ./virtualenv/') venv = 'source ./virtualenv/venv/bin/activate && ' local(venv+'pip install mysql-python django South')
得到这个错误:
➜ fab fab init [localhost] local: mkdir ./virtualenv [localhost] local: cd ./virtualenv && virtualenv --no-site-packages venv New python executable in venv/bin/python Installing distribute...........................................................................................................................................................................................................................done. Installing pip................done. [localhost] local: chown -R user:user ./virtualenv/ [lcalhost] local: chmod 770 -R ./virtualenv/ [localhost] local: source ./virtualenv/venv/bin/activate && pip install mysql-python django South /bin/sh: 1: source: not found Fatal error: local() encountered an error (return code 127) while executing 'source ./virtualenv/venv/bin/activate && pip install mysql-python django South' Aborting.
从 zsh运行
source ./virtualenv/venv/bin/activate && pip install mysql-python django South
,并观察它是否有效。
这不是类似这样的重复问题,因为即使我with prefix(
在代码中使用 a 我也会遇到相同的错误。
有任何想法吗?