我正在尝试进行打包程序构建。
我的源 AMI 是一个 Ubuntu 盒子。我想安装并运行一个 python 虚拟环境。
我的供应商如下所示。apt-get 工作正常,它创建了一个 virtualenv。但是,当我激活源时,它失败了。我收到以下错误:/tmp/script.sh: 53: /tmp/script.sh
看来我无法source
在我的打包程序版本中运行。我该如何解决这个问题?我需要运行 virtualenv 并pip install
从里面做。
"provisioners": [
{
"type": "shell",
"inline": [
"echo '70'",
"sudo apt-get --assume-yes install python-virtualenv",
"echo '80'",
"sudo virtualenv /home/myuser/myVirtualEnv",
"echo '90'",
"ls -altr /home/myuser/myVirtualEnv/bin",
"echo '95'",
"source /home/myuser/myVirtualEnv/bin/activate",
"echo '100'",
]
}
]
这是控制台输出:
myHostName: 70
myHostName: Reading package lists... Done
myHostName: Building dependency tree
myHostName: Reading state information... Done
myHostName: The following NEW packages will be installed:
myHostName: python-virtualenv
myHostName: 0 upgraded, 1 newly installed, 0 to remove and 125 not upgraded.
myHostName: Need to get 1,485 kB of archives.
myHostName: After this operation, 1,935 kB of additional disk space will be used.
myHostName: Get:1 http://us-east-1.ec2.archive.ubuntu.com/ubuntu/ trusty/universe python-virtualenv all 1.11.4-1 [1,485 kB]
myHostName: Fetched 1,485 kB in 0s (22.5 MB/s)
myHostName: Selecting previously unselected package python-virtualenv.
myHostName: (Reading database ... 56592 files and directories currently installed.)
myHostName: Preparing to unpack .../python-virtualenv_1.11.4-1_all.deb ...
myHostName: Unpacking python-virtualenv (1.11.4-1) ...
myHostName: Processing triggers for man-db (2.6.7.1-1ubuntu1) ...
myHostName: Setting up python-virtualenv (1.11.4-1) ...
myHostName: 80
myHostName: New python executable in /home/myuser/myVirtualEnv/bin/python
myHostName: Installing setuptools, pip...done.
myHostName: 90
myHostName: total 3312
myHostName: lrwxrwxrwx 1 root root 6 Jun 25 17:21 python2.7 -> python
myHostName: lrwxrwxrwx 1 root root 6 Jun 25 17:21 python2 -> python
myHostName: -rwxr-xr-x 1 root root 3345416 Jun 25 17:21 python
myHostName: -rwxr-xr-x 1 root root 254 Jun 25 17:21 easy_install-2.7
myHostName: -rwxr-xr-x 1 root root 254 Jun 25 17:21 easy_install
myHostName: -rwxr-xr-x 1 root root 226 Jun 25 17:21 pip2.7
myHostName: -rwxr-xr-x 1 root root 226 Jun 25 17:21 pip2
myHostName: -rwxr-xr-x 1 root root 226 Jun 25 17:21 pip
myHostName: drwxr-xr-x 6 root root 4096 Jun 25 17:21 ..
myHostName: -rw-r--r-- 1 root root 1129 Jun 25 17:21 activate_this.py
myHostName: -rw-r--r-- 1 root root 2476 Jun 25 17:21 activate.fish
myHostName: -rw-r--r-- 1 root root 1263 Jun 25 17:21 activate.csh
myHostName: -rw-r--r-- 1 root root 2207 Jun 25 17:21 activate
myHostName: drwxr-xr-x 2 root root 4096 Jun 25 17:21 .
myHostName: 95
myHostName: /tmp/script.sh: 53: /tmp/script.sh: source: not found
myHostName: 100