问题
Using official example from here I have a mistake:
Traceback (most recent call last):
File "/home/vv/PythProj/esi-code/webapp/sp_token.py", line 2, in <module>
from spacy.en import English
File "/home/vv/anaconda3/lib/python3.6/site-packages/spacy/__init__.py", line 4, in <module>
from . import util
File "/home/vv/anaconda3/lib/python3.6/site-packages/spacy/util.py", line 5, in <module>
import regex as re
File "/home/vv/anaconda3/lib/python3.6/site-packages/regex.py", line 394, in <module>
import _regex_core
File "/home/vv/anaconda3/lib/python3.6/site-packages/_regex_core.py", line 21, in <module>
import _regex
ImportError: /home/vv/anaconda3/lib/python3.6/site-packages/_regex.cpython-36m-x86_64-linux-gnu.so: undefined symbol: PySlice_AdjustIndices
How can I fix it? Thank you for help
Additional information:
for command: conda search "^python$"
Fetching package metadata .........
python 1.0.1 0 conda-forge
1.0.1 0 defaults
... // closely 50 tuples
3.6.1 0 defaults
3.6.1 1 conda-forge
3.6.1 2 conda-forge
3.6.1 2 defaults
for command:
python --version
Python 3.6.0 :: Anaconda custom (64-bit)
for command:
pip --version
pip 9.0.1 from /home/vv/anaconda3/lib/python3.6/site-packages (python 3.6)
回答1:
I cannot explain it, but it works when I run idle3 under sudo:
I use Python shell and run it from terminal by command: idle3. Later when I compile the code I get the aforementioned mistake.
but: when I start from terminal: sudo idle3 it works perfect without any mistakes. So, I think it's a question from access in ubuntu.
Thank you for all!
来源:https://stackoverflow.com/questions/44095147/how-to-fix-a-python-spacy-error-undefined-symbol-pyslice-adjustindices