当我尝试为spacy安装英语模型时出现此错误 ImportError:' random':b' \ x03 \ xf3 \ r \ n'中的错误幻数 任何帮助都会受到重视
这是追溯错误:
Traceback (most recent call last):
File "C:\Users\Saurav\AppData\Local\Programs\Python\Python36-32\lib\runpy.py", line 183, in _run_module_as_main
mod_name, mod_spec, code = _get_module_details(mod_name, _Error)
File "C:\Users\Saurav\AppData\Local\Programs\Python\Python36-32\lib\runpy.py", line 142, in _get_module_details
return _get_module_details(pkg_main_name, error)
File "C:\Users\Saurav\AppData\Local\Programs\Python\Python36-32\lib\runpy.py", line 109, in _get_module_details
__import__(pkg_name)
File "C:\Users\Saurav\AppData\Local\Programs\Python\Python36-32\lib\site-packages\spacy\__init__.py", line 4, in <module>
from .cli.info import info as cli_info
File "C:\Users\Saurav\AppData\Local\Programs\Python\Python36-32\lib\site-packages\spacy\cli\__init__.py", line 1, in <module>
from .download import download
File "C:\Users\Saurav\AppData\Local\Programs\Python\Python36-32\lib\site-packages\spacy\cli\download.py", line 10, in <module>
from .link import link
File "C:\Users\Saurav\AppData\Local\Programs\Python\Python36-32\lib\site-packages\spacy\cli\link.py", line 8, in <module>
from ..compat import symlink_to, path2str
File "C:\Users\Saurav\AppData\Local\Programs\Python\Python36-32\lib\site-packages\spacy\compat.py", line 9, in <module>
from thinc.neural.util import copy_array
File "C:\Users\Saurav\AppData\Local\Programs\Python\Python36-32\lib\site-packages\thinc\neural\__init__.py", line 1, in <module>
from ._classes.model import Model
File "C:\Users\Saurav\AppData\Local\Programs\Python\Python36-32\lib\site-packages\thinc\neural\_classes\model.py", line 2, in <module>
from numpy import prod
File "C:\Users\Saurav\AppData\Local\Programs\Python\Python36-32\lib\site-packages\numpy\__init__.py", line 142, in <module>
from . import add_newdocs
File "C:\Users\Saurav\AppData\Local\Programs\Python\Python36-32\lib\site-packages\numpy\add_newdocs.py", line 13, in <module>
from numpy.lib import add_newdoc
File "C:\Users\Saurav\AppData\Local\Programs\Python\Python36-32\lib\site-packages\numpy\lib\__init__.py", line 8, in <module>
from .type_check import *
File "C:\Users\Saurav\AppData\Local\Programs\Python\Python36-32\lib\site-packages\numpy\lib\type_check.py", line 11, in <module>
import numpy.core.numeric as _nx
File "C:\Users\Saurav\AppData\Local\Programs\Python\Python36-32\lib\site-packages\numpy\core\__init__.py", line 74, in <module>
from numpy.testing import _numpy_tester
File "C:\Users\Saurav\AppData\Local\Programs\Python\Python36-32\lib\site-packages\numpy\testing\__init__.py", line 12, in <module>
from . import decorators as dec
File "C:\Users\Saurav\AppData\Local\Programs\Python\Python36-32\lib\site-packages\numpy\testing\decorators.py", line 6, in <module>
from .nose_tools.decorators import *
File "C:\Users\Saurav\AppData\Local\Programs\Python\Python36-32\lib\site-packages\numpy\testing\nose_tools\decorators.py", line 20, in <module>
from .utils import SkipTest, assert_warns
File "C:\Users\Saurav\AppData\Local\Programs\Python\Python36-32\lib\site-packages\numpy\testing\nose_tools\utils.py", line 15, in <module>
from tempfile import mkdtemp, mkstemp
File "C:\Users\Saurav\AppData\Local\Programs\Python\Python36-32\lib\tempfile.py", line 45, in <module>
from random import Random as _Random
ImportError: bad magic number in 'random': b'\x03\xf3\r\n'
这就是我用来安装scapy及其英文模型的原因:
pip install -U spacy
python -m spacy download en