cloudant模块将不会与pip一起安装 [英] cloudant module will not install with pip

查看:59
本文介绍了cloudant模块将不会与pip一起安装的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尝试使用IBM网页上的指示将cloudant模块安装在树莓派1版本b上.

trying to install the cloudant module on a raspberry pi ver 1 rev b using the instructions from IBM's web page.

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

然后:cd get-started-python

最终:pip install -r requirements.txt

我想将cloudant模块与python 2.7一起使用我已经了解过环境变量可能是一个问题,但老实说我迷路了.我读过很多有关安装问题的文章,但到目前为止没有任何效果...

I want to use the cloudant module with python 2.7 I've read about the environment variable possibly being an issue, but honestly i'm lost. I've read many posts about problems installing, but so far nothing works...

我收到以下错误消息:

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.

更新: 所以这是我的代码:

UPDATE: so this is my code:

from cloudant.client import cloudant

使用python3 code.py运行我的代码,我收到错误消息"

running my code using python3 code.py I get the error message"

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

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可以解决此问题...

While I don't fully understand why changing my import statement to from cloudant import Cloundant fixes the issue...

推荐答案

在Python 3.0中,参数encoding已添加到open().尽管软件包声明与Python2兼容,但setup.py中的此代码仅适用于Python3.请注意它们仅为Python3提供滚轮.

Parameter encoding was added to open() in Python 3.0. This code in setup.py is Python3-only despite the packages declares compatibility with Python2. Please note they provide wheels only for Python3.

要么使用encoding是一个错误,要么声明与Python2的兼容性是一个错误.哪一个由作者决定. 报告问题,让他们解决.

Either using encoding is a bug or declaring compatibility with Python2 is a bug. Which one is for the authors to decide. Report the problem and let's them to resolve.

或尝试使用Python3.

Or try Python3.

这篇关于cloudant模块将不会与pip一起安装的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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