GVKun编程网logo

ImportError:没有名为pythoncom的模块(没有名为numpy的模块)

1

在本文中,您将会了解到关于ImportError:没有名为pythoncom的模块的新资讯,同时我们还将为您解释没有名为numpy的模块的相关在本文中,我们将带你探索ImportError:没有名为p

在本文中,您将会了解到关于ImportError:没有名为pythoncom的模块的新资讯,同时我们还将为您解释没有名为numpy的模块的相关在本文中,我们将带你探索ImportError:没有名为pythoncom的模块的奥秘,分析没有名为numpy的模块的特点,并给出一些关于heroku python3:ImportError:没有名为’encodings’的模块、ImportError:Python中没有名为*****的模块、ImportError:没有名为Cython.Distutils的模块、ImportError:没有名为PIL的模块的实用技巧。

本文目录一览:

ImportError:没有名为pythoncom的模块(没有名为numpy的模块)

ImportError:没有名为pythoncom的模块(没有名为numpy的模块)

我是这个Python世界的新手(仅1周)。我尝试安装django-mssql,但是当我尝试导入库(使用importsqlserver_ado.dbapi)时,出现以下错误消息:

ImportError: No module named pythoncom

我试图寻找那个图书馆而没有成功。

你们能指出我正确的方向吗?

答案1

小编典典

您缺少pythoncom包裹。它带有ActivePython,但您可以将它作为pywin32的一部分单独在GitHub(以前在SourceForge上)上获得。

您也可以简单地使用:

pip install pywin32

heroku python3:ImportError:没有名为’encodings’的模块

heroku python3:ImportError:没有名为’encodings’的模块

我一直试图让我的 python3 reddit bot在heroku上工作一段时间,但我一直遇到这个错误:

~ $python3
Fatal Python error: Py_Initialize: Unable to get the locale encoding
ImportError: No module named ''encodings''
Aborted (core dumped)

当我在远程bash会话中运行python3时(通过heroku run bash),就会发生这种情况.

heroku日志输出:

2015-03-29T09:41:23.669871+00:00 heroku[bot.1]: Starting process with command `python3 allb.py`
2015-03-29T09:41:24.315878+00:00 heroku[bot.1]: State changed from starting to up
2015-03-29T09:41:24.978050+00:00 app[bot.1]: Fatal Python error: Py_Initialize: Unable to get the locale encoding
2015-03-29T09:41:24.978079+00:00 app[bot.1]: ImportError: No module named ''encodings''
2015-03-29T09:41:25.811735+00:00 heroku[bot.1]: State changed from up to crashed
2015-03-29T09:41:25.801807+00:00 heroku[bot.1]: Process exited with status 134

我已经尝试将运行时设置为3.4,并寻找类似于问题的解决方案.有些消息来源说$PYTHONPATH必须是零,而heroku上的$PYTHONPATH有值/ app //.

这可能是一些愚蠢的错误,但我找不到它.

解决方法

您需要在runtime.txt文件中指定您的python版本.

https://devcenter.heroku.com/articles/python-runtimes

然后在推动你会看到:

遥控器:—–>找到python-2.7.13,删除

遥控器:—–>安装python-3.6.1

ImportError:Python中没有名为*****的模块

ImportError:Python中没有名为*****的模块

我是python的新手,大约一个月了,正在尝试弄清楚python中的导入方式。有人告诉我可以导入其中包含Python代码的任何“模块”。因此,我试图导入一个模块只是为了进行尝试,但我不断收到“
ImportError:没有名为redue的模块”。这是python shell的示例:

>>> import os
>>> os.chdir('C:\Users\Cube\Documents\Python')
>>> for file in os.listdir(os.getcwd()):
     print file
pronounce.py
pronounce.pyc
readwrite.py
rectangle.py
reduc.py

>>> import reduc

Traceback (most recent call last):
   File "<pyshell#32>",line 1,in <module>
    import reduc
ImportError: No module named reduc

我究竟做错了什么?我正在忽略某些东西,还是只是被错误告知?

ImportError:没有名为Cython.Distutils的模块

ImportError:没有名为Cython.Distutils的模块

尝试zenlib使用其setup.py文件安装Python库时遇到一个奇怪的问题。运行setup.py文件时,出现导入错误,提示

ImportError:没有名为Cython.Distutils的模块

但是我确实有这样的模块,并且可以在python命令行上导入它而没​​有任何麻烦。为什么会出现此导入错误?

我认为问题可能与以下事实有关:我使用的是预先安装的Enthought Python
Distribution,而不是使用Ubuntu 12.04随附的Python 2.7。

更多背景信息:这正是尝试运行setup.py时得到的信息:

enwe101@enwe101-PCL:~/zenlib/src$ sudo python setup.py installTraceback (most recent call last):  File "setup.py", line 4, in <module>    from Cython.Distutils import build_extImportError: No module named Cython.Distutils

但是它可以从命令行运行:

>>> from Cython.Distutils import build_ext>>> >>> from fake.package import noexistTraceback (most recent call last):  File "<stdin>", line 1, in <module>ImportError: No module named fake.package

请注意,第一个导入有效,第二个导入引发错误。将此与setup.py的前几行进行比较:

#from distutils.core import setupfrom setuptools import setupfrom distutils.extension import Extensionfrom Cython.Distutils import build_extimport os.path

我确保通过默认方式运行bash $ PATH环境变量~/.bashrc,并通过编辑将其添加到最后一行,从而确保默认情况下运行的是Enthought
Python发行版而不是Ubuntu随附的python :

export PATH=/usr/local/epd/bin:$PATH

果然whichpython吐出来/usr/local/epd/bin/python......不知道什么尝试,我走进我的网站packages目录,(
/usr/local/epd/lib/python2.7/site-packages)和充分的权限(R,W,X)来CythonDistutilsbuild_ext.py,和__init__.py文件。尝试可能很愚蠢,但没有改变。

想不出下一步该怎么做!?有任何想法吗?

答案1

小编典典

您的sudo没有获得正确的python。这是Ubuntu中sudo的已知行为。有关更多信息,请参见此问题。您需要通过使用完整路径来确保sudo调用正确的python:

sudo /usr/local/epd/bin/python setup.py install

或通过执行以下操作(以bash方式):

alias sudo=''sudo env PATH=$PATH''sudo python setup.py install

ImportError:没有名为PIL的模块

ImportError:没有名为PIL的模块

我在外壳中使用以下命令来安装PIL:

easy_install PIL

然后我运行python,并输入:import PIL。但是我得到这个错误:

Traceback (most recent call last):
  File "<console>",line 1,in <module>
ImportError: No module named PIL

我从来没有遇到过这样的问题,您怎么看?

关于ImportError:没有名为pythoncom的模块没有名为numpy的模块的问题就给大家分享到这里,感谢你花时间阅读本站内容,更多关于heroku python3:ImportError:没有名为’encodings’的模块、ImportError:Python中没有名为*****的模块、ImportError:没有名为Cython.Distutils的模块、ImportError:没有名为PIL的模块等相关知识的信息别忘了在本站进行查找喔。

本文标签: