简体   繁体   English

如何克隆存储库以便可以在 Python 中正常导入?

[英]How do I clone a repository so it can be imported normally in Python?

I am looking for a way (or a folder) to clone a Git repository so after doing so, I can import it in Python like I import any other library.我正在寻找一种方法(或文件夹)来克隆 Git 存储库,因此在这样做之后,我可以像导入任何其他库一样将其导入 Python 中。

Command line:命令行:

git clone newpackage.git

Python: Python:

import newpackage

Maybe any Python related folder in my system/user variables?也许我的系统/用户变量中有任何 Python 相关文件夹?

Cloning the repository is not enough, you also have to actually install it.克隆存储库是不够的,您还必须实际安装它。

Usually;通常;

cd newpackage
python setup.py install

(You will probably need root/administrator provileges to install a package.) (您可能需要 root/管理员权限才能安装 package。)

After installation, you should be able to import the package.安装后,您应该可以导入 package。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何使用 python git clone 存储库,并获取克隆过程的进度? - How can I git clone a repository with python, and get the progress of the clone process? 你如何创建一个 GitHub Repository 以便我可以自动导入和导出 python 脚本? - How do you create a GitHub Repository so that I can automatically import and export python scripts? 通常我在命令行上运行:python main.py image/archive/True,那么我如何在 tkinter gui 上运行 - Normally i run on command line : python main.py image/ archive/ True , so how can i run on tkinter gui 我如何让jenkins在一系列python测试脚本中修改一个URL,所以我可以维护一个存储库 - How do I get jenkins to modify one URL in a series of python test scripts, so I can maintain a single repository 我如何使用Python和PyGithub / GitPython克隆git存储库? - How i can clone my the git repository using Python and PyGithub/GitPython? 如何在python 3.x中初始化模块以便可以导入? - How to initialize a module in python 3.x so that it can be imported? 如何在 Python 中移动导入的图像 - how can I move imported image in Python 如何在python中取消缓存导入的模块? - How can I uncache imported module in python? 如何在iPython中正常显示异常? - How can I display exceptions normally in iPython? 当我尝试克隆不存在的存储库时,如何阻止 git 询问凭据? - How do I stop git from asking credentials when I try to clone a repository that doesn't exist?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM