GVKun编程网logo

导入错误:没有名为 numpy 的模块(没有numpy库怎么办)

49

关于导入错误:没有名为numpy的模块和没有numpy库怎么办的问题就给大家分享到这里,感谢你花时间阅读本站内容,更多关于django导入错误-没有名为core.management的模块、Djang

关于导入错误:没有名为 numpy 的模块没有numpy库怎么办的问题就给大家分享到这里,感谢你花时间阅读本站内容,更多关于django 导入错误 - 没有名为 core.management 的模块、Django-导入错误:没有名为* .urls的模块、PyInstaller - 导入错误:没有名为 _bootlocale 的模块、python 3.8中的导入错误:没有名为“_abc”的模块等相关知识的信息别忘了在本站进行查找喔。

本文目录一览:

导入错误:没有名为 numpy 的模块(没有numpy库怎么办)

导入错误:没有名为 numpy 的模块(没有numpy库怎么办)

我按照这个链接安装了 numpy - 正如问题中所建议的那样。安装很顺利,但是当我执行

import numpy

我收到以下错误:

导入错误:没有名为 numpy 的模块

我知道这可能是一个超级基本的问题,但我仍在学习。

谢谢

django 导入错误 - 没有名为 core.management 的模块

django 导入错误 - 没有名为 core.management 的模块

好的,我看到很多这样的错误。我已经尝试了我所知道的一切,但还没有弄清楚。

我正在开发一个运行 python 2.5 和 Django 1.3 的开发服务器。解压 tar.gz 下载后,使用 python setup.py
install 安装了 Django 1.3。

一切正常,我很少需要运行manage.py,但我正在尝试使用新的静态文件应用程序并遇到问题。

python manage.py collectstatic
Traceback (most recent call last):
  File "manage.py",line 2,in <module>
    from django.core.management import execute_manager
ImportError: No module named core.management

好的,所以我有PATH问题。

Django
install
我仔细检查我的site-packages目录。

python -c "from distutils.sysconfig import get_python_lib; print get_python_lib()"
/usr/lib/python2.5/site-packages

好的,让我们看看我有什么,echo $PYTHON_PATH 是空的,所以我设置了它

export PYTHON_PATH=/usr/lib/python2.5/site-packages/django

仍然没有运气。让我们检查一下 sys.path 必须说什么

>>> import sys
>>> print sys.path
['','/usr/lib/python2.5','/usr/lib/python2.5/plat-linux2','/usr/lib/python2.5/lib-tk','/usr/lib/python2.5/lib-dynload','/usr/local/lib/python2.5/site-packages','/usr/lib/python2.5/site-packages','/usr/lib/python2.5/site-packages/PIL','/usr/lib/python2.5/site-packages/django','/var/lib/python-support/python2.5']

路径在那里,我什至用内容创建了 /usr/lib/python2.5/site-packages/django.pth

cat /usr/lib/python2.5/site-packages/django.pth 
/usr/lib/python2.5/site-packages/django/

有人知道这里发生了什么吗?

我在阻碍路径的更远处找到了一个符号链接,但没有出现新的错误。

python manage.py collectstatic
Traceback (most recent call last):
  File "manage.py",line 14,in <module>
    execute_manager(settings)
  File "/usr/lib/python2.5/site-packages/django/core/management/__init__.py",line 438,in execute_manager
    utility.execute()
  File "/usr/lib/python2.5/site-packages/django/core/management/__init__.py",line 349,in execute
    version=get_version(),File "/usr/lib/python2.5/site-packages/django/__init__.py",line 12,in get_version
    from django.utils.version import get_svn_revision
ImportError: No module named utils.version

我还尝试创建一个新项目以查看那里是否存在任何问题并得到相同的 utils.version 错误。

侧节点:来自#django 的 Unode 帮助了我一点,在同一台机器上设置 virtualenv
并克服了错误,所以仍然不确定这里实际安装的情况,但它似乎不在 django 项目中,而是在 django /python 安装。

Django-导入错误:没有名为* .urls的模块

Django-导入错误:没有名为* .urls的模块

我正在研究官方的Django教程,并使用Django
1.6.1版,Python 2.7.6对其稍作调整以适应我的需要。

我正要映射URL,但是当很明显其中有一个模块具有适当命名的文件时,我会不断收到“无模块命名为customers.urls”的错误,所以我真的迷失了什么我做错了

我最初的想法是,我需要在root / urls.py中导入与客户相关的内容,但是每种导入组合都会导致大致相同的错误,并且本教程没有说要这样做。

ROOT_URLCONF =’taco.urls’(taco是项目的名称)

我正在使用manage.py/runserver运行此程序,因此我知道并没有发生任何特殊的Web服务器骗局。我已经重启了好几次。

追溯可以证明,所有应用程序都已正确注册。

任何关于我忽略的东西的指针将不胜感激!

root / urls.py:

from django.conf.urls import patterns, include, urlfrom django.contrib import adminadmin.autodiscover()urlpatterns = patterns('''',    url(r''^customers/'', include(''customers.urls'')),    url(r''^admin/'', include(admin.site.urls)),)

客户/urls.py:

from django.conf.urls import patterns, url;from customers import views;urlpatterns = ('''',     url(r''^$'', views.index, name=''index''));

客户/views.py:

from django.shortcuts import renderfrom django.http import HttpResponse;def index(request):    return HttpResponse("Hello");

追溯

Environment:Request Method: GETRequest URL: http://192.168.3.208:8000/customers/Django Version: 1.6.1Python Version: 2.7.6Installed Applications:(''django.contrib.admin'', ''django.contrib.auth'', ''django.contrib.contenttypes'', ''django.contrib.sessions'', ''django.contrib.messages'', ''django.contrib.staticfiles'', ''south'', ''taco.customers'', ''taco.inventory'', ''taco.lookups'', ''taco.orders'')Installed Middleware:(''django.contrib.sessions.middleware.SessionMiddleware'', ''django.middleware.common.CommonMiddleware'', ''django.middleware.csrf.CsrfViewMiddleware'', ''django.contrib.auth.middleware.AuthenticationMiddleware'', ''django.contrib.messages.middleware.MessageMiddleware'', ''django.middleware.clickjacking.XFrameOptionsMiddleware'')Traceback:File "/usr/lib/python2.7/dist-packages/django/core/handlers/base.py" in get_response  99.                 resolver_match = resolver.resolve(request.path_info)File "/usr/lib/python2.7/dist-packages/django/core/urlresolvers.py" in resolve  337.             for pattern in self.url_patterns:File "/usr/lib/python2.7/dist-packages/django/core/urlresolvers.py" in url_patterns  365.         patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)File "/usr/lib/python2.7/dist-packages/django/core/urlresolvers.py" in urlconf_module  360.             self._urlconf_module = import_module(self.urlconf_name)File "/usr/lib/python2.7/dist-packages/django/utils/importlib.py" in import_module  40.         __import__(name)File "/var/project/taco/taco/urls.py" in <module>  7.     url(r''^customers/'', include(''customers.urls'')),File "/usr/lib/python2.7/dist-packages/django/conf/urls/__init__.py" in include  26.         urlconf_module = import_module(urlconf_module)File "/usr/lib/python2.7/dist-packages/django/utils/importlib.py" in import_module  40.         __import__(name)Exception Type: ImportError at /customers/Exception Value: No module named customers.urls

答案1

小编典典

在您的customer / urls.py中:

更改此:

urlpatterns = ('''',     url(r''^$'', views.index, name=''index''));

为了这:

urlpatterns = patterns('''',     url(r''^$'', views.index, name=''index''));

另外,请确保您的__init__.py文件位于包中customers。这INSTALLED_APPS是否正确填写你的应用程序名称。

INSTALLED_APPS = (    ''django.contrib.auth'',    ''django.contrib.contenttypes'',    ''django.contrib.sessions'',    ''django.contrib.sites'',    ''django.contrib.messages'',    ''django.contrib.staticfiles'',    ''django.contrib.admin'',    ''south'',    ''customers'',    ''inventory'',    ''lookups'',    ''orders'',)

PyInstaller - 导入错误:没有名为 _bootlocale 的模块

PyInstaller - 导入错误:没有名为 _bootlocale 的模块

如何解决PyInstaller - 导入错误:没有名为 _bootlocale 的模块?

每次我尝试在 PyInstaller 中编译 python 文件时,它都会返回很多错误。

这些是编译错误...

Traceback (most recent call last):
  File "c:\users\Person\appdata\local\programs\python\python310\lib\runpy.py",line 197,in _run_module_as_main
    return _run_code(code,main_globals,None,File "c:\users\Persong\appdata\local\programs\python\python310\lib\runpy.py",line 87,in _run_code
    exec(code,run_globals)
  File "C:\Users\Person\AppData\Local\Programs\Python\python310\Scripts\pyinstaller.exe\__main__.py",line 7,in <mo
dule>
  File "c:\users\Person\appdata\local\programs\python\python310\lib\site-packages\PyInstaller\__main__.py",line 114,in run
    run_build(pyi_config,spec_file,**vars(args))
  File "c:\users\Person\appdata\local\programs\python\python310\lib\site-packages\PyInstaller\__main__.py",line 65,in run_build
    PyInstaller.building.build_main.main(pyi_config,**kwargs)
  File "c:\users\Person\appdata\local\programs\python\python310\lib\site-packages\PyInstaller\building\build_main.py
",line 725,in main
    build(specfile,kw.get(''distpath''),kw.get(''workpath''),kw.get(''clean_build''))
  File "c:\users\Person\appdata\local\programs\python\python310\lib\site-packages\PyInstaller\building\build_main.py
",line 672,in build
    exec(code,spec_namespace)
  File "E:\___Python___\auto.spec",line 6,in <module>
    a = Analysis([''auto.py''],File "c:\users\Person\appdata\local\programs\python\python310\lib\site-packages\PyInstaller\building\build_main.py
",line 242,in __init__
    self.__postinit__()
  File "c:\users\Person\appdata\local\programs\python\python310\lib\site-packages\PyInstaller\building\datastruct.py
",line 160,in __postinit__
    self.assemble()
  File "c:\users\Person\appdata\local\programs\python\python310\lib\site-packages\PyInstaller\building\build_main.py
",line 341,in assemble
    self.graph = initialize_modgraph(
  File "c:\users\Person\appdata\local\programs\python\python310\lib\site-packages\PyInstaller\depend\analysis.py",l
ine 799,in initialize_modgraph
    graph = PyiModuleGraph(
  File "c:\users\Person\appdata\local\programs\python\python310\lib\site-packages\PyInstaller\depend\analysis.py",l
ine 120,in __init__
    self._analyze_base_modules()
  File "c:\users\Person\appdata\local\programs\python\python310\lib\site-packages\PyInstaller\depend\analysis.py",l
ine 288,in _analyze_base_modules
    self._base_modules = [mod
  File "c:\users\Person\appdata\local\programs\python\python310\lib\site-packages\PyInstaller\depend\analysis.py",l
ine 290,in <listcomp>
    for mod in self.import_hook(req)]
  File "c:\users\Person\appdata\local\programs\python\python310\lib\site-packages\PyInstaller\lib\modulegraph\module
graph.py",line 1496,in import_hook
    target_package,target_module_partname = self._find_head_package(
  File "c:\users\Person\appdata\local\programs\python\python310\lib\site-packages\PyInstaller\lib\modulegraph\module
graph.py",line 1681,in _find_head_package
    raise ImportError("No module named " + target_package_name)
ImportError: No module named _bootlocale

我关注的主要错误之一如下...

raise ImportError("No module named " + target_package_name)
ImportError: No module named _bootlocale

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

python 3.8中的导入错误:没有名为“_abc”的模块

python 3.8中的导入错误:没有名为“_abc”的模块

如何解决python 3.8中的导入错误:没有名为“_abc”的模块?

我在尝试构建 cura-build-environment 时遇到问题,在构建文件中运行 sudo make 后我得到了这个..

 [ 43%] Performing configure step for ''Savitar''
-- Find shared libpython: /usr/local/lib/libpython3.8.so
Fatal Python error: Py_Initialize: can''t initialize sys standard streams
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/abc.py",line 64,in <module>
ImportError: No module named ''_abc''

During handling of the above exception,another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.8/io.py",line 52,in <module>
  File "/usr/local/lib/python3.8/abc.py",line 68,in <module>
  File "/usr/local/lib/python3.8/_py_abc.py",line 35
    def __new__(mcls,name,bases,namespace,/,**kwargs):
                                              ^
SyntaxError: invalid Syntax
CMake Error at cmake/FindSIP.cmake:47 (message):
  Failed to get python3_SITELIB.  Error:
Call Stack (most recent call first):
  CMakeLists.txt:48 (find_package)


-- Configuring incomplete,errors occurred!

我尝试重新安装 python3.8,但仍然没有运气。 这是 Savitar 的 CMakeLists.txt 的片段,我认为这是导致问题的原因:

project(savitar)
cmake_minimum_required(VERSION 3.8)    
##### find python
execute_process(COMMAND python3-config --prefix OUTPUT_VARIABLE PYTHON_SEARCH_PATH)
string(REGEX REPLACE "\n$" "" PYTHON_SEARCH_PATH "${PYTHON_SEARCH_PATH}")
file(GLOB_RECURSE PYTHON_DY_LIBS ${PYTHON_SEARCH_PATH}/lib/libpython*.dylib ${PYTHON_SEARCH_PATH}/lib/libpython*.so)
if (PYTHON_DY_LIBS)
    list(GET PYTHON_DY_LIBS 0 PYTHON_LIBRARY)
    message("-- Find shared libpython: ${PYTHON_LIBRARY}")
else()
    message(WARNING "Cannot find shared libpython,try find_package")
endif()#####

if(BUILD_PYTHON)
    list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake)

    # FIXME: Remove the code for CMake <3.12 once we have switched over completely.
    # Findpython3 is a new module since CMake 3.12. It deprecates FindPythonInterp and FindPythonLibs.
    if(${CMAKE_VERSION} VERSION_LESS 3.12)
        # FIXME: Use Findpython3 to find Python,new in CMake 3.12.
        # However currently on our CI server it finds the wrong Python version and then doesn''t find the headers.
        find_package(PythonInterp 3.4 required)
        find_package(PythonLibs 3.4 required)
    find_package(python3_EXECUTABLE Interpreter)
    else()
        # Use Findpython3 for CMake >=3.12
        find_package(python3 3.4 required COMPONENTS Interpreter Development)

    endif()

    find_package(SIP required)
    if(NOT DEFINED LIB_SUFFIX)
        set(LIB_SUFFIX "")
    endif()

    include_directories(python/ src/ ${SIP_INCLUDE_Dirs} ${python3_INCLUDE_Dirs})
endif()

更新

如果我没记错的话,问题来自 SIP 包,因为这是 cmakefile 给出错误的地方! 在 find_package(SIP required) 如果我尝试卸载 sip,它会显示 sip 的位置在 .local/python3.5 中!这可能是问题?但解决方案是什么??

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

关于导入错误:没有名为 numpy 的模块没有numpy库怎么办的问题就给大家分享到这里,感谢你花时间阅读本站内容,更多关于django 导入错误 - 没有名为 core.management 的模块、Django-导入错误:没有名为* .urls的模块、PyInstaller - 导入错误:没有名为 _bootlocale 的模块、python 3.8中的导入错误:没有名为“_abc”的模块等相关知识的信息别忘了在本站进行查找喔。

本文标签: