[英]How can I edit a GitHub repository (for a Python package) locally and run the package with my changes?
I have cloned a GitHub repository that contains the code for a Python package to my local computer (it's actually on a high performance cluster).我已经将包含 Python package 代码的 GitHub 存储库克隆到我的本地计算机(它实际上位于高性能集群上)。 I have also installed the package with pip install 'package_name'.
我还使用 pip install 'package_name' 安装了 package。 If I now run a script that uses the package, it of course uses the installed package and not the cloned repository, so if I want to make changes to the code, I cannot run those.
如果我现在运行一个使用 package 的脚本,它当然会使用已安装的 package 而不是克隆的存储库,因此如果我想更改代码,我将无法运行这些代码。 Is there a way to do this, potentially with pip install -e (but I read that was deprecated) or a fork?
有没有办法做到这一点,可能使用 pip install -e (但我读到它已被弃用)或叉子? How could I then get novel updates in the package to my local version, as it is frequently updated?
我怎么能把 package 中的小说更新到我的本地版本,因为它经常更新?
If you run an IDE like PyCharm, you can mark a folder in your project as Sources Root.如果你运行一个 IDE 比如 PyCharm,你可以在你的项目中标记一个文件夹作为 Sources Root。 It will then import any packages from that folder instead of the standard environment packages.
然后它将从该文件夹中导入任何包而不是标准环境包。
In the end I indeed did use pip install -e, and it is working for now.最后我确实使用了 pip install -e,目前它正在工作。 I will figure it out once the owner of the package releases another update!
一旦 package 的所有者发布另一个更新,我就会解决这个问题!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.