0

我用 python 的“pip”安装了一个应用程序:

sudo pip install EasyBlogger

安装完成,没有错误:

Collecting EasyBlogger
  Using cached EasyBlogger-0.9.0.zip
Requirement already satisfied (use --upgrade to upgrade): pypandoc in /usr/lib/python3.5/site-packages (from EasyBlogger)
Requirement already satisfied (use --upgrade to upgrade): google-api-python-client in /usr/lib/python3.5/site-packages (from EasyBlogger)
Requirement already satisfied (use --upgrade to upgrade): python-gflags in /usr/lib/python3.5/site-packages (from EasyBlogger)
Requirement already satisfied (use --upgrade to upgrade): httplib2 in /usr/lib/python3.5/site-packages (from EasyBlogger)
Requirement already satisfied (use --upgrade to upgrade): setuptools in /usr/lib/python3.5/site-packages (from pypandoc->EasyBlogger)
Requirement already satisfied (use --upgrade to upgrade): oauth2client>=1.4.6 in /usr/lib/python3.5/site-packages (from google-api-python-client->EasyBlogger)
Requirement already satisfied (use --upgrade to upgrade): six>=1.6.1 in /usr/lib/python3.5/site-packages (from google-api-python-client->EasyBlogger)
Requirement already satisfied (use --upgrade to upgrade): uritemplate>=0.6 in /usr/lib/python3.5/site-packages (from google-api-python-client->EasyBlogger)
Requirement already satisfied (use --upgrade to upgrade): pyasn1>=0.1.7 in /usr/lib/python3.5/site-packages (from oauth2client>=1.4.6->google-api-python-client->EasyBlogger)
Requirement already satisfied (use --upgrade to upgrade): pyasn1-modules>=0.0.5 in /usr/lib/python3.5/site-packages (from oauth2client>=1.4.6->google-api-python-client->EasyBlogger)
Requirement already satisfied (use --upgrade to upgrade): rsa>=3.1.4 in /usr/lib/python3.5/site-packages (from oauth2client>=1.4.6->google-api-python-client->EasyBlogger)
Requirement already satisfied (use --upgrade to upgrade): simplejson>=2.5.0 in /usr/lib/python3.5/site-packages (from uritemplate>=0.6->google-api-python-client->EasyBlogger)
Installing collected packages: EasyBlogger
  Running setup.py install for EasyBlogger
Successfully installed EasyBlogger-0.9.0

但是,当我尝试按以下方式运行 scipt 时:

sudo easyblogger --blogid 6852822618950333369 get

我只收到错误消息:

Traceback (most recent call last):
  File "/usr/bin/easyblogger", line 9, in <module>
    load_entry_point('EasyBlogger==0.9.0', 'console_scripts', 'easyblogger')()
  File "/usr/lib/python3.5/site-packages/pkg_resources/__init__.py", line 568, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/usr/lib/python3.5/site-packages/pkg_resources/__init__.py", line 2720, in load_entry_point
    return ep.load()
  File "/usr/lib/python3.5/site-packages/pkg_resources/__init__.py", line 2380, in load
    return self.resolve()
  File "/usr/lib/python3.5/site-packages/pkg_resources/__init__.py", line 2386, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
  File "/usr/lib/python3.5/site-packages/blogger/__init__.py", line 1, in <module>
    from blogger import EasyBlogger, main
ImportError: cannot import name 'EasyBlogger'

/usr/bin/easyblogger 的内容如下:

#!/usr/bin/python3
# EASY-INSTALL-ENTRY-SCRIPT: 'EasyBlogger==0.9.0','console_scripts','easyblogger'
__requires__ = 'EasyBlogger==0.9.0'
import sys
from pkg_resources import load_entry_point

if __name__ == '__main__':
    sys.exit(
        load_entry_point('EasyBlogger==0.9.0', 'console_scripts', 'easyblogger')()
    )

错误来自 9. line load_entry_point。我该怎么做才能使 easyblogger 脚本正常工作?无论如何,我正在使用 Arch Linux。

4

1 回答 1

0

我看到您使用的是 Python 3。它似乎easyblogger不兼容,即使它使用pip3.

要看到这一点,请通过添加一个句点来更正__init__.py,因为您是从当前文件夹导入的(python 3 中的新功能):

from .blogger import EasyBlogger, main

现在,如果你运行你的命令,你会得到以下信息:

  File "/usr/local/lib/python3.4/dist-packages/blogger/blogger.py", line 424
    print postId
               ^
SyntaxError: Missing parentheses in call to 'print'

现在您需要决定是否修复软件包!只是为了确保在 Python 3 中安装:

sudo apt-get -y install python3-setuptools
sudo easy_install3 pip
sudo pip3 install EasyBlogger
于 2016-10-12T15:09:20.377 回答