简体   繁体   中英

How to install Python package from GitHub that doesn't have setup.py in it

I would like to use the following sdk in my python project -> https://github.com/LBank-exchange/lbank-api-sdk-v2 . It has sdk's for 3 languages (I just want the python one). I tried to install it using the command:

pip install git+https://github.com/LBank-exchange/lbank-api-sdk-v2.git#egg=lbank

which gave the error

does not appear to be a Python project: neither 'setup.py' nor 'pyproject.toml' found .

Looks like the developer didn't bother to package it properly. It it was me using it, I would fork it on GH, add the setup.py and use the fork. Maybe a good exercise for you?

Meanwhile, to just get it to work, in your project "root":

git clone https://github.com/LBank-exchange/lbank-api-sdk-v2.git
ln -s lbank-api-sdk-v2/python-sdk-api/LBank ./LBank

Then in your code just import LBank . This will leave the cloned repo untouched (so you can git pull to update it later) and just link the module directory to the root. Alternatively you can just include the api directory in sys.path for imports to work.

Think there is nothing to install, if you want to be able to "import" and use it like other packages you install through pip install you can just add the folder to your sys-path:

import sys
sys.path.append("path")

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