2024-06-11 02:08:07 发布
网友
我不确定python使用什么方法来包含从github获取的另一个库。在
我计划使用这个库https://github.com/nim901/gfycat,现在我刚刚下载了zip并将其解压缩并放入lib文件夹中。我得把这个图书馆登记进回购系统才能在Heroku工作。有没有办法从github自动安装lib?在
zip
lib
您可以将库添加为项目的submodule。这将允许您像任何其他git存储库一样更新它。在
git clone https://github.com/nim901/gfycat.git和{}是否足够自动?如果这个解决方案适合您,并且您需要附加说明,我将添加它们。在
git clone https://github.com/nim901/gfycat.git
Heroku通过pip:https://devcenter.heroku.com/articles/python-pip#git-backed-distributions支持git支持的python依赖项
我相信这比将实际的库检入git更符合您的需求。从上面的链接:
Anything that works with a standard pip requirements file will work as expected on Heroku.Thanks to pip’s Git support, you can install a Python package that is hosted on a remote Git repository.For example:git+git://github.com/kennethreitz/requests.git
Anything that works with a standard pip requirements file will work as expected on Heroku.
Thanks to pip’s Git support, you can install a Python package that is hosted on a remote Git repository.
For example:
git+git://github.com/kennethreitz/requests.git
从我对你的问题的理解来看,听起来你是在尝试将模块安装到系统中,以便能够将其导入到项目中等等。在
下载zip文件,将其解压到任何地方,并打开同一目录的终端窗口。然后在目录中运行python setup.py install,它应该安装到python的系统范围的site-packages目录中。在
python setup.py install
site-packages
我建议您将其安装到由virtualenv(https://virtualenv.pypa.io/en/latest/)管理的自己的环境中,但这不是必需的。在
virtualenv
您可以将库添加为项目的submodule。这将允许您像任何其他git存储库一样更新它。在
git clone https://github.com/nim901/gfycat.git
和{Heroku通过pip:https://devcenter.heroku.com/articles/python-pip#git-backed-distributions支持git支持的python依赖项
我相信这比将实际的库检入git更符合您的需求。从上面的链接:
从我对你的问题的理解来看,听起来你是在尝试将模块安装到系统中,以便能够将其导入到项目中等等。在
下载zip文件,将其解压到任何地方,并打开同一目录的终端窗口。然后在目录中运行
python setup.py install
,它应该安装到python的系统范围的site-packages
目录中。在我建议您将其安装到由
virtualenv
(https://virtualenv.pypa.io/en/latest/)管理的自己的环境中,但这不是必需的。在相关问题 更多 >
编程相关推荐