【问题标题】:git clone + install in Pythongit clone + 在 Python 中安装
【发布时间】:2015-08-02 19:23:46
【问题描述】:

是否有一个单行快捷方式:

git clone https://github.com/user/mypythonmodule.git
cd mypythonmodule
python setup.py install
cd ..

喜欢

git clone install https://github.com/user/mypythonmodule.git

还是不存在?

【问题讨论】:

  • git clone github.com/user/mypythonmodule.git && python mypythonmodule/setup.py install
  • 使用 pypi 安装它:pip install mypythonmodule
  • @PeterClause:我试过了,但没有用,因为你的解决方案不会是mypythonmodule
  • @ImanMirzadeh:这样的 git 项目并不总是在 Pypi 上
  • @Basj:是的!但它们通常是:D

标签: python git pip


【解决方案1】:

如果你使用 pip 它支持从 git URL 安装。

来自pip documentation

"pip 目前支持通过 git、git+https 和 git+ssh 进行克隆"

你会这样做

pip install git+https://github.com/user/mypythonmodule.git

【讨论】:

  • 太棒了,不知道。
  • 不错的解决方案。我承认,我首先想避免要求目标用户安装pip,因为在我的 Raspbian Wheezy 上:apt-get install python-pip 安装 pip + .... Python 2.6 在 Python 2.7 之上 ...:太丑了!跨度>
  • Raspbian Jessie 中是否默认使用 Python 2.7?或者,如果你有一个 python 2.7 easy_install,你可以使用它而不是 apt 来安装 pip。
  • @StephenPaulger,没有git+prefix 真的可以吗?对我来说,它似乎必须是pip install git+https://github.com/user/mypythonmodule.git
猜你喜欢
  • 2018-12-05
  • 2019-06-13
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2021-12-13
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多