I pip the "opencc"
when i shell the code below
import opencc
it shows
Traceback (most recent call last):
File "<pyshell#0>", line 1, in <module>
import opencc
File "C:\Python34\lib\site-packages\opencc\__init__.py", line 6, in <module>
from version import __version__
ImportError: No module named 'version'
but "____init__.py"and"version.py" are in the same directory C:\Python34\lib\site-packages\opencc
opencc
|----__init__.py
|----version.py
file:version.py
__version__ = '0.1'
when i change
from version import __version__
into
__version__ = '0.1'
opencc,it works
I know it doesn't make a big difference,but i just want to know why the init.py can't import the module version.py in the same directory,
The opencc
module is not compatible with Python 3. It can currently only be used on Python 2.
Specifically, the version
module is part of the opencc
package, but in Python 3 you'd need to use absolute imports, from opencc.version import __version__
or from .version import __version__
. There will be other issues with the code too.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With