通过 .ebextensions 安装 pip 包
Installing pip package through .ebextensions
我在通过 ebextensions
安装软件包 psycopg2
时遇到问题。
00_software.config
packages:
yum:
git: []
htop: []
pip:
psycopg2: []
01_setup_pg_activity.config
commands:
clone:
command: git clone https://github.com/dalibo/pg_activity.git
install_psycopg2:
command: cd pg_activity && python setup.py install
或者,这个我也试过了,没用
commands:
clone:
command: git clone https://github.com/dalibo/pg_activity.git
install_psycopg2:
command: pip install psycopg2
install_psycopg2:
command: cd pg_activity && python setup.py install
其他软件可以安装但是pip包不会
Traceback (most recent call last):
File "/usr/local/bin/pg_activity", line 4, in <module>
__import__('pkg_resources').run_script('pg-activity==1.6.1', 'pg_activity')
File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 742, in run_script
self.require(requires)[0].run_script(script_name, ns)
File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 1510, in run_script
exec(script_code, namespace, namespace)
File "/usr/local/lib/python2.7/site-packages/pg_activity-1.6.1-py2.7.egg/EGG-INFO/scripts/pg_activity", line 42, in <module>
ImportError: No module named psycopg2
我必须手动进入 运行 sudo pip install psycopg2
才能正确安装。我如何在构建过程中执行此操作?
将 EB 与 AL2 一起使用(python env;尚未在 RoR 上进行测试),已成功安装 pg_activity
。
对于软件包(仅显示 psycopg2)我有
packages:
yum:
python-psycopg2: []
commands
配置文件是 (20_setup_pg_activity.config):
commands:
05_clone:
command: git clone https://github.com/dalibo/pg_activity.git
10_install_pg_activity:
command: cd pg_activity && python setup.py install
在环境设置之后,我登录到 EB 实例以检查 pg_activity
是否存在(仅显示部分):
ec2-user@ip-172-31-82-127 ~]$ pg_activity --help
Usage: pg_activity [options]
htop like application for PostgreSQL server activity monitoring.
Options:
--version show program's version number and exit
-U USERNAME, --username=USERNAME
如果您使用的是虚拟环境并且 EB CLI,则在虚拟环境处于活动状态时,只需创建 requirements.txt
就足够了。 EB CLI 在部署时处理包安装。
我在通过 ebextensions
安装软件包 psycopg2
时遇到问题。
00_software.config
packages:
yum:
git: []
htop: []
pip:
psycopg2: []
01_setup_pg_activity.config
commands:
clone:
command: git clone https://github.com/dalibo/pg_activity.git
install_psycopg2:
command: cd pg_activity && python setup.py install
或者,这个我也试过了,没用
commands:
clone:
command: git clone https://github.com/dalibo/pg_activity.git
install_psycopg2:
command: pip install psycopg2
install_psycopg2:
command: cd pg_activity && python setup.py install
其他软件可以安装但是pip包不会
Traceback (most recent call last):
File "/usr/local/bin/pg_activity", line 4, in <module>
__import__('pkg_resources').run_script('pg-activity==1.6.1', 'pg_activity')
File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 742, in run_script
self.require(requires)[0].run_script(script_name, ns)
File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 1510, in run_script
exec(script_code, namespace, namespace)
File "/usr/local/lib/python2.7/site-packages/pg_activity-1.6.1-py2.7.egg/EGG-INFO/scripts/pg_activity", line 42, in <module>
ImportError: No module named psycopg2
我必须手动进入 运行 sudo pip install psycopg2
才能正确安装。我如何在构建过程中执行此操作?
将 EB 与 AL2 一起使用(python env;尚未在 RoR 上进行测试),已成功安装 pg_activity
。
对于软件包(仅显示 psycopg2)我有
packages:
yum:
python-psycopg2: []
commands
配置文件是 (20_setup_pg_activity.config):
commands:
05_clone:
command: git clone https://github.com/dalibo/pg_activity.git
10_install_pg_activity:
command: cd pg_activity && python setup.py install
在环境设置之后,我登录到 EB 实例以检查 pg_activity
是否存在(仅显示部分):
ec2-user@ip-172-31-82-127 ~]$ pg_activity --help
Usage: pg_activity [options]
htop like application for PostgreSQL server activity monitoring.
Options:
--version show program's version number and exit
-U USERNAME, --username=USERNAME
如果您使用的是虚拟环境并且 EB CLI,则在虚拟环境处于活动状态时,只需创建 requirements.txt
就足够了。 EB CLI 在部署时处理包安装。