您可以创建一个
install.py脚本并按脚本调用
pip。
import pip_all_ = [ "SOAPpy>=0.12.22", "pycrypto>=2.6.1", "suds>=0.4", "Python-ldap>=2.4.19", "paramiko>=1.15.2", "nose>=1.3.4", "selenium>=2.44.0", "bottle>=0.12.8", "CherryPy>=3.6.0", "pika>=0.9.14",]windows = ["wmi-client-wrapper>=0.0.12",]linux = ["WMI>=1.4.9",]darwin = []def install(packages): for package in packages: pip.main(['install', package])if __name__ == '__main__': from sys import platform install(_all_) if platform == 'windows': install(windows) if platform.startswith('linux'): install(linux) if platform == 'darwin': # MacOS install(darwin)
仅使用
requirements文件解决此问题的另一种方法应该是使用
requirements
requirements.txt
SOAPpy>=0.12.22pycrypto>=2.6.1suds>=0.4Python-ldap>=2.4.19paramiko>=1.15.2nose>=1.3.4selenium>=2.44.0bottle>=0.12.8CherryPy>=3.6.0
windows.txt
-r requirements.txtWMI>=1.4.9
linux.txt
-r requirements.txtWMI>=1.4.9
然后,您可以仅调用等同于平台的需求。
pip install -r windows.txtpip install -r linux.txt
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)