安装模块 cbpro 在其他几个项目中抛出多个错误(python 3.10,pycharm)

Install module cbpro throws multiple errors in several other projects (python 3.10, pycharm)

我做了几个 运行 很好的项目。一个新项目需要我安装 pip install cbpro(一个处理 coinbase 加密货币的模块 API)。

安装后,即使是 运行最简单的代码也会抛出几个错误:

输入:

import cbpro

导入 pandas 作为 pd c = cbpro.PublicClient()

数据=pd.DataFrame(c.get_products()) data.tail().T

Errors:
Traceback (most recent call last):
  File "/Users/me/PycharmProjects/stonks/coinbase_interface.py", line 1, in <module>
    import cbpro
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/cbpro/__init__.py", line 1, in <module>
    from cbpro.authenticated_client import AuthenticatedClient
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/cbpro/authenticated_client.py", line 10, in <module>
    import requests
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/requests/__init__.py", line 63, in <module>
    from . import utils
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/requests/utils.py", line 29, in <module>
    from .cookies import RequestsCookieJar, cookiejar_from_dict
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/requests/cookies.py", line 174, in <module>
    class RequestsCookieJar(cookielib.CookieJar, collections.MutableMapping):
AttributeError: module 'collections' has no attribute 'MutableMapping'

其次,当我转到其他运行良好的项目时,我遇到了其他错误。值得注意的是,这些项目以:

import pandas as pd
import requests
import json

错误:

Traceback (most recent call last):
  File "/Users/me/PycharmProjects/stonks/historical_crypto_pull.py", line 2, in <module>
    import requests
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/requests/__init__.py", line 63, in <module>
    from . import utils
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/requests/utils.py", line 29, in <module>
    from .cookies import RequestsCookieJar, cookiejar_from_dict
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/requests/cookies.py", line 174, in <module>
    class RequestsCookieJar(cookielib.CookieJar, collections.MutableMapping):
AttributeError: module 'collections' has no attribute 'MutableMapping'

我尝试过的事情:

我使用的库与 Python 3.10 不兼容。我仍然不知道如何根据抛出的错误从本质上知道这一点,但从那以后我的解决方案是安装 Python 3.9 并查看在 运行 3.9 时是否仍然出现相同的错误。

(然后我还读到,对于我目前的目的来说,使用稍旧版本的 Python 可能是一个更好的主意,所以我完全移到了 3.9 并且没有再遇到同样的问题.)