簡體   English   中英

cloudant 模塊不會與 pip 一起安裝

[英]cloudant module will not install with pip

嘗試使用 IBM 的 web 頁面中的說明在 raspberry pi ver 1 rev b 上安裝 cloudant 模塊。

第一個: git clone https://github.com/IBM-Cloud/get-started-python

然后: cd get-started-python

最后: pip install -r requirements.txt

我想將 cloudant 模塊與 python 2.7 一起使用我已經讀過環境變量可能是一個問題,但老實說我迷路了。 我已經閱讀了很多關於安裝問題的帖子,但到目前為止沒有任何效果......

我收到以下錯誤消息:

pi@rpi-2:~/hms/get-started-python $ pip install -r requirements.txt

DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support

Defaulting to user installation because normal site-packages is not writeable
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Requirement already satisfied: Flask>=1.0.0 in /usr/lib/python2.7/dist-packages (from -r requirements.txt (line 1)) (1.0.2)
Collecting cloudant==2.13.0
  Using cached cloudant-2.13.0.tar.gz (60 kB)
    ERROR: Command errored out with exit status 1:
     command: /usr/bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-d8SSO0/cloudant/setup.py'"'"'; __file__='"'"'/tmp/pip-install-d8SSO0/cloudant/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 /tmp/pip-pip-egg-info-7Btkkf
         cwd: /tmp/pip-install-d8SSO0/cloudant/
    Complete output (5 lines):
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-install-d8SSO0/cloudant/setup.py", line 33, in <module>
        with open(path.join(this_directory, 'README.md'), encoding='utf-8') as f:
    TypeError: 'encoding' is an invalid keyword argument for this function
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

更新:所以這是我的代碼:

from cloudant.client import cloudant

使用python3 code.py運行我的代碼我收到錯誤消息“

Traceback (most recent call last): File "code.py", line 1, in <module> from cloudant.client import cloudant ModuleNotFoundError: No module named 'cloudant'

雖然我不完全理解為什么將我的導入語句更改為from cloudant import Cloundant解決問題......

Python 3.0 中的open()添加了參數encoding setup.py中的此代碼僅適用於 Python3,盡管包聲明與 Python2 兼容。 請注意,它們僅為 Python3 提供輪子

使用encoding是一個錯誤,或者聲明與 Python2 的兼容性是一個錯誤。 哪一個由作者決定。 報告問題,讓他們解決。

或者試試 Python3。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM