python无法找到入口,Python入口点'console_scripts'未找到

I'm unable to import entry point console scripts in my python package. Looking for help debugging my current issue, as I have read every relevant post on the issue.

Here is what my directory structure looks like:

├── ContentAnalysis

│   ├── __init__.py

│   ├── command_line.py

│   ├── document.py

│   ├── entities.py

│   ├── sentiment.py

│   ├── summary.py

│   ├── text_tokenize.py

│   ├── tokens.py

├── local-requirements.txt

├── requirements.txt

├── server-requirements.txt

├── setup.py

└── tests

├── tests.py

└── tests.pyc

Here is what my setup.py looks like

from setuptools import setup

config = {

'description': 'Tools to extract information from web links',

'author': 'sample',

'version': '0.1',

'install_requires': ['nose'],

'packages': ['ContentAnalysis'],

'entry_points': {

'console_scripts': ['content_analysis=ContentAnalysis.command_line:main'],

},

'name':'ContentAnalysis',

'include_package_data':True

}

setup(**config)

I've installed the package and verified that content_analysis is reachable from the command line. I've also verified that my ContentAnalysis package is importable from the python interpreter from any cd in the computer. Yet I still get an "Entry point not found error on execution"

grant@DevBox2:/opt/content-analysis$ content_analysis -l 'http://101beauty.org/how-to-use-baking-soda-to-reduce-dark-circles-and-bags-under-the-eyes/'

Traceback (most recent call last):

File "/opt/anaconda2/bin/content_analysis", line 11, in

load_entry_point('ContentAnalysis==0.1', 'console_scripts', 'content_analysis')()

File "/opt/anaconda2/lib/python2.7/site-packages/setuptools-26.1.1-py2.7.egg/pkg_resources/__init__.py", line 565, in load_entry_point

File "/opt/anaconda2/lib/python2.7/site-packages/setuptools-26.1.1-py2.7.egg/pkg_resources/__init__.py", line 2588, in load_entry_point

ImportError: Entry point ('console_scripts', 'content_analysis') not found

Any help or tips towards debugging this is appreciated

Edit #1:

Attempting to debug the issue, I noticed the command_line is not reachable as a submodule within ContentAnalysis

>>> import ContentAnalysis

>>> ContentAnalysis.tokens

>>> ContentAnalysis.command_line

Traceback (most recent call last):

File "", line 1, in

AttributeError: 'module' object has no attribute 'command_line'

>>>

It appears that command_line is not being added to the relevant site_packages folder.

grant@DevBox2:/opt/anaconda2/lib/python2.7/site-packages/ContentAnalysis$ ls

data entities.py __init__.pyc summary.py text_tokenize.pyc

document.py entities.pyc sentiment.py summary.pyc tokens.py

document.pyc __init__.py sentiment.pyc text_tokenize.py tokens.pyc

I wonder why?

解决方案

Investigation of the relevant site-packages folder clued me that my python setup.py install command was not putting all the relevant files where they needed to be.

I'm still not 100% of the underlying cause of the issue, but I was only able to get my site-packages folder to truly update by passing setup.py the --force argument as in

python setup.py install --force

Now my site-packages folder contains the relevant command_line.py, and the console entry point works as expected.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值