创建用于安装API的setup.py [英] creating setup.py for installing API

查看:112
本文介绍了创建用于安装API的setup.py的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

https://github.com/SocksPls/hltv-api.git 当我尝试安装时,出现此错误

https://github.com/SocksPls/hltv-api.git this one when i tried to install i get a this error

Collecting git+https://github.com/SocksPls/hltv-api.git
  Cloning https://github.com/SocksPls/hltv-api.git to c:\users\shait\appdata\local\temp\pip-req-build-h5h_opsb
  Running command git clone -q https://github.com/SocksPls/hltv-api.git 'C:\Users\shait\AppData\Local\Temp\pip-req-build-h5h_opsb'
    ERROR: Command errored out with exit status 1:
     command: 'c:\users\shait\appdata\local\programs\python\python37-32\python.exe' -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\shait\\AppData\\Local\\Temp\\pip-req-build-h5h_opsb\\setup.py'"'"'; __file__='"'"'C:\\Users\\shait\\AppData\\Local\\Temp\\pip-req-build-h5h_opsb\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base 'C:\Users\shait\AppData\Local\Temp\pip-req-build-h5h_opsb\pip-egg-info'
         cwd: C:\Users\shait\AppData\Local\Temp\pip-req-build-h5h_opsb\
    Complete output (5 lines):
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "c:\users\shait\appdata\local\programs\python\python37-32\lib\tokenize.py", line 447, in open
        buffer = _builtin_open(filename, 'rb')
    FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\shait\\AppData\\Local\\Temp\\pip-req-build-h5h_opsb\\setup.py'
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output

如果没有setup.py文件,Pip无法下载,我该如何创建它?

Pip can't download without setup.py file, how can i create it?

推荐答案

您链接的项目没有setup.py,因此pip无法实际安装.您正在寻找的最有可能做的事情:

The project you linked does not have a setup.py, so pip cannot actually install it. What you are looking for is most likely to do:

git clone https://github.com/SocksPls/hltv-api

进入新的/hltv-api文件夹并执行:

Go into the new /hltv-api folder and do:

pip install -r requirements.txt

从那里您将能够在该项目中使用/修改/导入main.py.但是请注意,您将只能从同一目录中导入main.py文件.在同一目录中创建一个tool.py并使用以下模块:

From there you will be able to use/modify/import the main.py inside this project. Note, however, that you will only be able to import the main.py file from inside the same directory. Create a tool.py within the same dir and use the module:

import main as hltv
hltv.top5teams()

这篇关于创建用于安装API的setup.py的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆