在Ruby中,当我同时开发一个库和一个应用程序时,我可以使用Bundler的local override特性使应用程序使用库的本地副本,而不是试图从系统上的Github获取。这很方便。你知道吗
# Given my application's Gemfile with this one line...
gem 'mylib', :github => 'smackesey/mylib', :branch => 'master'
# I can run this once in my shell...
bundle config local.mylib /path/to/mylib
# And now on my system, the app will use the copy at /path/to/my/lib
我现在在Python中也面临类似的情况。requirements.txt
本质上等同于Gemfile,但是pip
是否支持本地重写功能?你知道吗
您可以使用
pip install -e git+ssh://...#egg=package-name
(此处替换your repository URL)安装库的可编辑版本。这将创建库的签出并将其放入python模块搜索路径。如果已经有库的本地副本,那么执行pip install -e /path/to/your/checkout
也会执行同样的操作。如果已经安装了库的不可编辑版本,则可能需要将upgrade
传递给pip。你知道吗在幕后,pip将在
site-packages
目录中创建一个名为easy-install.pth
的文件,其中包含一行指向库签出的完整路径。您可以阅读更多关于.pth
文件in the official Python documentation;有关更多pip选项,请参阅the official pip documentation,here是关于editable installs的部分。你知道吗相关问题 更多 >
编程相关推荐