小编mar*_*k32的帖子

为什么我收到此错误“ModuleNotFoundError:没有名为“binance.client”的模块;binance安装后'binance'不是一个包'?

我正在使用 Visual Studio 代码尝试从 Binance 中提取蜡烛,但我不断收到以下错误:

ModuleNotFoundError: No module named 'binance.client'; 'binance' is not a package
Run Code Online (Sandbox Code Playgroud)

这是导致错误的代码行:

from binance.client import Client
Run Code Online (Sandbox Code Playgroud)

我已经确保我将 python-binance 安装到了正确的 python 版本,从我读到的内容来看,我猜测路径有问题,但我不确定要寻找什么。我运行以下代码检查路径

import pprint, os
import binance

pprint.pprint(os.path.abspath(binance.__file__))
Run Code Online (Sandbox Code Playgroud)

这是我的结果

'/Users/myName/.local/lib/python3.7/site-packages/binance.py'
Run Code Online (Sandbox Code Playgroud)

我读到,名为 binance.py 的文件可能会弄乱它,但这是下载时给出的名称。如果您对它的样子感到好奇,那就是:

import hmac
import hashlib
import logging
import requests
import time
try:
    from urllib import urlencode

# for python3
except ImportError:
    from urllib.parse import urlencode


ENDPOINT = "https://www.binance.com"

BUY = "BUY"
SELL = "SELL"

LIMIT = "LIMIT"
MARKET = "MARKET"

GTC = "GTC"
IOC …
Run Code Online (Sandbox Code Playgroud)

python binance

9
推荐指数
2
解决办法
3万
查看次数

您可以使用 swift 将字符串附加到 Firebase 数组吗

我正在跟踪用户是否喜欢 firebase 中的餐厅,但我目前正在使用字符串来执行此操作。我知道可以在 Firebase 中更新数组,但根据我所读到的内容,为了执行此操作,每次要添加新元素时都需要重写整个数组。有什么方法可以将字符串附加到数组末尾吗?如果这是不可能的,有谁知道比仅使用字符串更好的替代方法吗?

这就是我现在正在使用的:

var likedBarsGlobal: [String] = [] {
    didSet {
        var lb = ""
        for i in 1...likedBarsGlobal.count - 1 {
            if(i == likedBarsGlobal.count - 1){
                lb += "\(likedBarsGlobal[i])"
            } else {
                lb += "\(likedBarsGlobal[i]), "
            }
        }

        db.collection("users").document(userId).updateData(["likedBars": lb ]) { (error) in
            if error != nil {
                print(error)
            }
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

arrays ios firebase swift google-cloud-firestore

1
推荐指数
1
解决办法
1746
查看次数

标签 统计

arrays ×1

binance ×1

firebase ×1

google-cloud-firestore ×1

ios ×1

python ×1

swift ×1