importerror

DLL load failed when importing PyQt5

馋奶兔 提交于 2019-11-26 06:39:27
问题 I have installed PyQt5 on windows platform and and getting an importError: DLL load failed. I have installed pyqt5 using the command pip3 install pyqt5 Successfully installed pyqt5-5.8.1 My Python version is as follows: Python 3.5.2 |Anaconda custom (64-bit)| (default, Jul 5 2016, 11:41:13) [MSC v.1900 64 bit (AMD64)] on win32 The import Error is as follows: from PyQt5.QtWidgets import QApplication Traceback (most recent call last): File \"<stdin>\", line 1, in <module> ImportError: DLL load

“ImportError: No module named” when trying to run Python script

瘦欲@ 提交于 2019-11-26 03:35:10
问题 I\'m trying to run a script that launches, amongst other things, a python script. I get a ImportError: No module named ..., however, if I launch ipython and import the same module in the same way through the interpreter, the module is accepted. What\'s going on, and how can I fix it? I\'ve tried to understand how python uses PYTHONPATH but I\'m thoroughly confused. Any help would greatly appreciated. 回答1: This issue arises due to the ways in which the command line IPython interpreter uses

ImportError: Cannot import name X

心不动则不痛 提交于 2019-11-26 01:24:26
问题 I have four different files named: main, vector, entity and physics. I will not post all the code, just the imports, because I think that\'s where the error is. (If you want, I can post more) Main: import time from entity import Ent from vector import Vect #the rest just creates an entity and prints the result of movement Entity: from vector import Vect from physics import Physics class Ent: #holds vector information and id def tick(self, dt): #this is where physics changes the velocity and

Python error “ImportError: No module named”

佐手、 提交于 2019-11-26 00:09:37
问题 Python is installed in a local directory. My directory tree looks like this: (local directory)/site-packages/toolkit/interface.py My code is in here: (local directory)/site-packages/toolkit/examples/mountain.py To run the example, I write python mountain.py , and in the code I have: from toolkit.interface import interface And I get the error: Traceback (most recent call last): File \"mountain.py\", line 28, in ? from toolkit.interface import interface ImportError: No module named toolkit

How to fix “Attempted relative import in non-package” even with __init__.py

拜拜、爱过 提交于 2019-11-25 22:57:27
问题 I\'m trying to follow PEP 328, with the following directory structure: pkg/ __init__.py components/ core.py __init__.py tests/ core_test.py __init__.py In core_test.py I have the following import statement from ..components.core import GameLoopEvents However, when I run, I get the following error: tests$ python core_test.py Traceback (most recent call last): File \"core_test.py\", line 3, in <module> from ..components.core import GameLoopEvents ValueError: Attempted relative import in non

Importing files from different folder

亡梦爱人 提交于 2019-11-25 21:39:16
问题 I have the following folder structure. application/app/folder/file.py and I want to import some functions from file.py in another Python file which resides in application/app2/some_folder/some_file.py I\'ve tried from application.app.folder.file import func_name and some other various attempts but so far I couldn\'t manage to import properly. How can I do this? 回答1: By default, you can't. When importing a file, Python only searches the current directory, the directory that the entry-point