对于我的项目,我使用Scipy,但看起来,我的项目很难从中导入内容。
Unhandled exception in thread started by <function check_errors.<locals>.wrapper at 0x7f2f4244f400>
Traceback (most recent call last):
File "/home/betaros/.local/lib/python3.5/site-packages/django/utils/autoreload.py", line 227, in wrapper
fn(*args, **kwargs)
File "/home/betaros/.local/lib/python3.5/site-packages/django/core/management/commands/runserver.py", line 125, in inner_run
self.check(display_num_errors=True)
File "/home/betaros/.local/lib/python3.5/site-packages/django/core/management/base.py", line 359, in check
include_deployment_checks=include_deployment_checks,
File "/home/betaros/.local/lib/python3.5/site-packages/django/core/management/base.py", line 346, in _run_checks
return checks.run_checks(**kwargs)
File "/home/betaros/.local/lib/python3.5/site-packages/django/core/checks/registry.py", line 81, in run_checks
new_errors = check(app_configs=app_configs)
File "/home/betaros/.local/lib/python3.5/site-packages/django/core/checks/urls.py", line 16, in check_url_config
return check_resolver(resolver)
File "/home/betaros/.local/lib/python3.5/site-packages/django/core/checks/urls.py", line 26, in check_resolver
return check_method()
File "/home/betaros/.local/lib/python3.5/site-packages/django/urls/resolvers.py", line 254, in check
for pattern in self.url_patterns:
File "/home/betaros/.local/lib/python3.5/site-packages/django/utils/functional.py", line 35, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "/home/betaros/.local/lib/python3.5/site-packages/django/urls/resolvers.py", line 405, in url_patterns
patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
File "/home/betaros/.local/lib/python3.5/site-packages/django/utils/functional.py", line 35, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "/home/betaros/.local/lib/python3.5/site-packages/django/urls/resolvers.py", line 398, in urlconf_module
return import_module(self.urlconf_name)
File "/usr/lib/python3.5/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 986, in _gcd_import
File "<frozen importlib._bootstrap>", line 969, in _find_and_load
File "<frozen importlib._bootstrap>", line 958, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 673, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 673, in exec_module
File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
File "/home/betaros/PycharmProjects/nsg-lfp/webFrontEnd/webFrontEnd/urls.py", line 20, in <module>
url(r'^pass_list/', include('pass_list.urls')),
File "/home/betaros/.local/lib/python3.5/site-packages/django/conf/urls/__init__.py", line 50, in include
urlconf_module = import_module(urlconf_module)
File "/usr/lib/python3.5/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 986, in _gcd_import
File "<frozen importlib._bootstrap>", line 969, in _find_and_load
File "<frozen importlib._bootstrap>", line 958, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 673, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 673, in exec_module
File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
File "/home/betaros/PycharmProjects/nsg-lfp/webFrontEnd/pass_list/urls.py", line 3, in <module>
from . import views
File "/home/betaros/PycharmProjects/nsg-lfp/webFrontEnd/pass_list/views.py", line 12, in <module>
import pass_eval_universal as pe
File "/home/betaros/PycharmProjects/nsg-lfp/logfile_lib/source/pass_eval_universal.py", line 3, in <module>
from sklearn.cluster import DBSCAN
File "/home/betaros/.local/lib/python3.5/site-packages/sklearn/__init__.py", line 57, in <module>
from .base import clone
File "/home/betaros/.local/lib/python3.5/site-packages/sklearn/base.py", line 10, in <module>
from scipy import sparse
File "/home/betaros/.local/lib/python3.5/site-packages/scipy/sparse/__init__.py", line 228, in <module>
from .base import *
ImportError: No module named 'scipy.sparse.base'
我正在使用Debian 9和Python 3.5.3以及PyCharm Community 2017.1.4。我使用pip for Python 3成功安装了以下软件包:
Django
XlsxWriter
appdirs
configparser
cycler
django-floppyforms
django-tables2
matplotlib
numpy
packaging
pip
pyparsing
python-dateutil
pytz
scikit-learn
scipy
setuptools
six
sklearn
如果我忘记了某些想法,请随意提问。每一个帮助都是适用的。
答案 0 :(得分:2)
我认为你的scipy安装搞砸了。我之前遇到过类似的问题,并解决了这个问题:
首先删除python scipy:
sudo apt-get purge python-scipy
然后使用apt-get
作为python包重新安装,例如sudo apt-get install python-scipy
,然后执行pip install scipy
。
希望这有帮助!