如何指定python pip的安装顺序? [英] How to specify install order for python pip?

查看:280
本文介绍了如何指定python pip的安装顺序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用fabric(0.9.4)+ pip(0.8.2),并且需要为多个服务器安装一些python模块.所有服务器均具有旧版本的setuptools(0.6c8),需要针对pymongo模块进行升级. Pymongo需要setuptools> = 0.6c9.

I'm working with fabric(0.9.4)+pip(0.8.2) and I need to install some python modules for multiple servers. All servers have old version of setuptools (0.6c8) which needs to be upgraded for pymongo module. Pymongo requires setuptools>=0.6c9.

我的问题是pip使用pymongo而不是setuptools开始安装,这会导致pip停止.在需求文件中改组模块顺序似乎无济于事.

My problem is that pip starts installation with pymongo instead of setuptools which causes pip to stop. Shuffling module order in requirements file doesn't seem to help.

requirements.txt:

requirements.txt:

setuptools>=0.6c9
pymongo==1.9
simplejson==2.1.3

是否有一种方法可以指定pip的安装顺序,因为它似乎无法单独正确地完​​成安装?

Is there a way to specify install order for pip as it doesn't seem to do it properly by itself?

可以用两个单独的需求文件解决这个问题,但是如果我现在或将来不需要维护多个需求文件,那就很好了.

This can be resolved with two separate requirements files but it would be nice if I didn't need to maintain multiple requirements files now or in the future.

问题仍然存在,点子为0.8.3.

Problem persists with pip 0.8.3.

推荐答案

这是一个愚蠢的hack,但是可能会起作用.编写一个bash脚本,该脚本逐行从您的需求文件读取并在其上运行pip命令.

This is a silly hack, but might just work. Write a bash script that reads from your requirements file line by line and runs the pip command on it.

#!/bin/bash
for line in $(cat requirements.txt)
do
  pip install $line -E /path/to/virtualenv
done

这篇关于如何指定python pip的安装顺序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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