Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

python新手 请教详细使用方法 #1

Closed
kaesi0 opened this issue Oct 8, 2018 · 10 comments
Closed

python新手 请教详细使用方法 #1

kaesi0 opened this issue Oct 8, 2018 · 10 comments

Comments

@kaesi0
Copy link

kaesi0 commented Oct 8, 2018

我一好朋友这两天就要生了,正好需要用这个看看.但python新手,win平台,clone了你的工程之后,cd到工程目录,运行
python qm.py --test
返回
Traceback (most recent call last):
File "qm.py", line 7, in
from crawler import Baidu, Baike, PCbaby, Httpcn
File "D:\Temp\qiming\crawler_init_.py", line 3, in
from .baidu import Baidu
File "D:\Temp\qiming\crawler\baidu.py", line 3, in
from base import Base
ModuleNotFoundError: No module named 'base'

不知道该怎么操作了 ,请详情说明一下,感谢~

@onestraw
Copy link
Owner

onestraw commented Oct 8, 2018

看一下Makefile, opencc安装方法不同

@PreRyo
Copy link

PreRyo commented Oct 8, 2018

同win平台,修改了baidu.py和baike.py下的导包代码from .base import Base 这个问题没了。。

但是出现了新问题
File "qm.py", line 7, in
from crawler import Baidu, Baike, PCbaby, Httpcn
File "D:\project\qiming-master\crawler_init_.py", line 3, in
from .baidu import Baidu
File "D:\project\qiming-master\crawler\baidu.py", line 3, in
from .base import Base
File "D:\project\qiming-master\crawler\base.py", line 8, in
from crawler import Helper
ImportError: cannot import name 'Helper'

Helper从哪来?感谢

@onestraw
Copy link
Owner

onestraw commented Oct 8, 2018

@PreRyo Helper 定义在 crawler/crawler.py 中,python 版本是2.7还是3.x ?

@PreRyo
Copy link

PreRyo commented Oct 8, 2018

@onestraw 3.x,更改了一系列后的导包代码后
Traceback (most recent call last):
File "qm.py", line 9, in
from tools import lookup, word_topk, word_freq
File "D:\project\qiming-master\tools_init_.py", line 10, in
wc = WordCount()
File "D:\project\qiming-master\tools\word_count.py", line 21, in init
self.count()
File "D:\project\qiming-master\tools\word_count.py", line 58, in count
rows = open(self.NameCorpusTxt).readlines()
UnicodeDecodeError: 'gbk' codec can't decode byte 0x8b in position 11: illegal m
ultibyte sequence

@onestraw
Copy link
Owner

onestraw commented Oct 8, 2018

@PreRyo sorry, 目前是基于2.7开发,还没有测试 3.x

@kaesi0
Copy link
Author

kaesi0 commented Oct 8, 2018

真心搞不来啊....麻烦lz说明一下如何使用 如何安装吧 win平台 怎么使用Makefile 以前没接触过....呃 我也是3.x

@PreRyo
Copy link

PreRyo commented Oct 8, 2018

@onestraw 好吧,文档注明一下就好

@kaesi0
Copy link
Author

kaesi0 commented Oct 8, 2018

最后....能提到pip....直接能pip install安装就太美妙了 感谢 @onestraw

@onestraw
Copy link
Owner

onestraw commented Oct 8, 2018

@kaesi0 make deps 调了pip install,不过windows安装opencc的方法需要自己找下,当前仅支持python 2.7,我去文档注一下

@onestraw onestraw mentioned this issue Dec 4, 2018
@onestraw
Copy link
Owner

onestraw commented Dec 5, 2018

已支持python3

@onestraw onestraw closed this as completed Dec 5, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants