在我的ipython笔记本中,我执行了命令
from sklearn.metrics import accuracy_score
然后我收到此导入错误。
ModuleNotFoundError: No module named 'multiprocessing'
因此,我尝试使用pip3安装多处理程序。我执行了命令
pip3 install multiprocessing
然后我又遇到另一个错误
SyntaxError: Missing parentheses in call to 'print'. Did you mean print('Macros:')?
我想知道如何解决这个问题?
第一个命令的整个错误日志
---------------------------------------------------------------------------
ModuleNotFoundError Traceback (most recent call last)
<ipython-input-4-6b5e50a91908> in <module>
----> 1 from sklearn.metrics import accuracy_score
~/.local/lib/python3.7/site-packages/sklearn/__init__.py in <module>
80 from . import _distributor_init # noqa: F401
81 from . import __check_build # noqa: F401
---> 82 from .base import clone
83 from .utils._show_versions import show_versions
84
~/.local/lib/python3.7/site-packages/sklearn/base.py in <module>
18
19 from . import __version__
---> 20 from .utils import _IS_32BIT
21
22 _DEFAULT_TAGS = {
~/.local/lib/python3.7/site-packages/sklearn/utils/__init__.py in <module>
18 import warnings
19 import numpy as np
---> 20 from scipy.sparse import issparse
21
22 from .murmurhash import murmurhash3_32
~/.local/lib/python3.7/site-packages/scipy/sparse/__init__.py in <module>
228
229 from .base import *
--> 230 from .csr import *
231 from .csc import *
232 from .lil import *
~/.local/lib/python3.7/site-packages/scipy/sparse/csr.py in <module>
15 from .sputils import upcast, get_index_dtype
16
---> 17 from .compressed import _cs_matrix
18
19
~/.local/lib/python3.7/site-packages/scipy/sparse/compressed.py in <module>
9 import numpy as np
10 from scipy._lib.six import zip as izip, xrange
---> 11 from scipy._lib._util import _prune_array
12
13 from .base import spmatrix, isspmatrix, SparseEfficiencyWarning
~/.local/lib/python3.7/site-packages/scipy/_lib/_util.py in <module>
7 import numbers
8 from collections import namedtuple
----> 9 from multiprocessing import Pool
10 import inspect
11
ModuleNotFoundError: No module named 'multiprocessing'
第二条命令是
Collecting multiprocessing
Downloading multiprocessing-2.6.2.1.tar.gz (108 kB)
|████████████████████████████████| 108 kB 225 kB/s
ERROR: Command errored out with exit status 1:
command: /usr/bin/python3 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-2qe70bj0/multiprocessing/setup.py'"'"'; __file__='"'"'/tmp/pip-install-2qe70bj0/multiprocessing/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-install-2qe70bj0/multiprocessing/pip-egg-info
cwd: /tmp/pip-install-2qe70bj0/multiprocessing/
Complete output (6 lines):
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-install-2qe70bj0/multiprocessing/setup.py", line 94
print 'Macros:'
^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print('Macros:')?
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
nani@nani:~$ pip3 install --upgrade numpy
如何解决该错误?