简体   繁体   中英

Importing function from Python script hosted on Github

Is there a simply way to download/save a Python script hosted on Github and then import a function within that script? I could manually save it and then import the function I need (of course), but I'd like to find a more self-contained solution. Ideally, I'd like to be able to send it to someone and have them run my script without having to manually download anything.

Any help?

You could use setuptools and write custom setup script for your package. Wrap your script into python package.

So users will be able install it via pip with just a single line:

pip install git+https://github.com/yournickname/reponame.git

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM