hys*_*sop 11 python oauth python-2.7
我正在尝试使用requests和requests_oauthlib,现在我只是尝试使用他们在requests_oauthlib文档中使用的死的简单Twitter验证凭据来确认我已经掌握了基础知识.我做了一个"pip install requests requests_oauthlib"来获取模块.在一个终端窗口我可以"导入请求"没问题,但是当我尝试"import requests_oauthlib"时,我得到了这个:
>>> import requests_oauthlib
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.7/site-packages/requests_oauthlib/__init__.py", line 1, in
<module>
from .oauth1_auth import OAuth1
File "/usr/lib/python2.7/site-packages/requests_oauthlib/oauth1_auth.py", line 10, in
<module>
from requests.utils import to_native_string
File "/usr/lib/python2.7/site-packages/requests/utils.py", line 23, in <module>
from . import __version__
ImportError: cannot import name __version__
Run Code Online (Sandbox Code Playgroud)
utils.py的第23行确实如下所示:
from . import __version__
Run Code Online (Sandbox Code Playgroud)
我在Fedora上使用Python 2.7.5,并且在多次尝试使其工作之后,我正在敲打这个墙,任何帮助都将不胜感激...
小智 6
检查__init__.py根目录.openpyxl从.constrants.json文件中读取这些信息.然而,PyInstaller无论如何都无法做到正确.我会你__version__.py自己写一个文件并替换它们__init__.py.
另一种更简单的方法是改变__init__.py如下:
import json
import os
# Modified to make it work in PyInstaller
#try:
# here = os.path.abspath(os.path.dirname(__file__))
# src_file = os.path.join(here, ".constants.json")
# with open(src_file) as src:
# constants = json.load(src)
# __author__ = constants['__author__']
# __author_email__ = constants["__author_email__"]
# __license__ = constants["__license__"]
# __maintainer_email__ = constants["__maintainer_email__"]
# __url__ = constants["__url__"]
# __version__ = constants["__version__"]
#except IOError:
# # packaged
# pass
__author__ = 'See AUTHORS'
__author_email__ = 'eric.gazoni@gmail.com'
__license__ = 'MIT/Expat'
__maintainer_email__ = 'openpyxl-users@googlegroups.com'
__url__ = 'http://openpyxl.readthedocs.org'
__version__ = '2.4.0-a1'
"""Imports for the openpyxl package."""
from openpyxl.compat.numbers import NUMPY, PANDAS
from openpyxl.xml import LXML
from openpyxl.workbook import Workbook
from openpyxl.reader.excel import load_workbook
print('You are using embedded openpyxl... 2.4.0-a1 ...')
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
16533 次 |
| 最近记录: |