tsroten / pynlpir

A Python wrapper around the NLPIR/ICTCLAS Chinese segmentation software.
MIT License
566 stars 135 forks source link

pynlpir.open()报错 #84

Closed Yif18 closed 6 years ago

Yif18 commented 7 years ago

import pynlpir pynlpir.open()

F:\Anaconda2\python.exe F:/PycharmProjects/yif001/pynlpir.py Traceback (most recent call last): File "F:/PycharmProjects/yif001/pynlpir.py", line 2, in import pynlpir File "F:\PycharmProjects\yif001\pynlpir.py", line 3, in pynlpir.open() AttributeError: 'module' object has no attribute 'open'

tsroten commented 7 years ago

I'm not familiar with Anaconda. Can you check if pynlpir is actually being imported as a module and what version it is?

import pynlpir
print(pynlpir.__version__)
print(dir(pynlpir))
lomizandtyd commented 7 years ago

This problem is caused by the name of your python script.

Rename your script, do not use 'pynlpir.py'.

python would load your file before load the pynlpir library.

tsroten commented 7 years ago

@lomizandtyd Nice job noticing that 😄