在Arch Linux上,我收到此错误,没有名为'scipy.stats'的模块
> python3 ./ddqn.py Traceback (most recent call last): File
> "/usr/lib/python3.7/site-packages/keras/backend/__init__.py", line 93,
> in <module>
> backend_module = importlib.import_module(_BACKEND) File "/usr/lib/python3.7/importlib/__init__.py", line 127, in import_module
> return _bootstrap._gcd_import(name[level:], package, level) File "<frozen importlib._bootstrap>", line 1006, in _gcd_import File
> "<frozen importlib._bootstrap>", line 983, in _find_and_load File
> "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
> File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
> File "<frozen importlib._bootstrap_external>", line 728, in
> exec_module File "<frozen importlib._bootstrap>", line 219, in
> _call_with_frames_removed File "/usr/lib/python3.7/site-packages/plaidml/keras/backend.py", line 31,
> in <module>
> import scipy.stats ModuleNotFoundError: No module named 'scipy.stats'
>
> During handling of the above exception, another exception occurred:
>
> Traceback (most recent call last): File "./ddqn.py", line 19, in
> <module>
> from keras.models import Sequential File "/usr/lib/python3.7/site-packages/keras/__init__.py", line 3, in
> <module>
> from . import utils File "/usr/lib/python3.7/site-packages/keras/utils/__init__.py", line 6, in
> <module>
> from . import conv_utils File "/usr/lib/python3.7/site-packages/keras/utils/conv_utils.py", line 9,
> in <module>
> from .. import backend as K File "/usr/lib/python3.7/site-packages/keras/backend/__init__.py", line
> 108, in <module>
> raise ValueError('Unable to import backend : ' + str(_BACKEND)) ValueError: Unable to import backend : plaidml.keras.backend
但是已安装此模块:
> ls /usr/lib/python3.7/site-packages/scipy/stats/
> __init__.py _multivariate.py mstats.py
> __pycache__ _rvs_sampling.py mstats_basic.py
> _binned_statistic.py _stats.cpython-37m-x86_64-linux-gnu.so mstats_extras.py
> _constants.py _stats_mstats_common.py mvn.cpython-37m-x86_64-linux-gnu.so
> _continuous_distns.py _tukeylambda_stats.py setup.py
> _discrete_distns.py contingency.py statlib.cpython-37m-x86_64-linux-gnu.so
> _distn_infrastructure.py distributions.py stats.py
> _distr_params.py kde.py tests
> _hypotests.py morestats.py vonmises.py
我尝试以两种不同的方式安装它:
pip3 install scipy
和
sudo pacman -S python-scipy
如何强制它在此位置查找模块?(/ usr / lib / python3.7 / site-packages / scipy / stats /)
答案 0 :(得分:1)
答案 1 :(得分:0)
我解析日志(由命令python3.7 -v -c "import scipy.stats" 2> log.txt
产生),发现它在$ HOME / .local / lib / python3.7 / site-packages / scipy / stats中搜索统计信息,但是统计信息不存在从那里删除scipy目录,所有工作。如果通过带有--user标志的pip安装,它将安装到$ HOME / .local / python3.7 / site-packages /