成功解决ModuleNotFoundError: No module named engine

简介: 成功解决ModuleNotFoundError: No module named engine


目录

解决问题

解决思路

解决方法


 

 

 

解决问题

ModuleNotFoundError: No module named 'engine'

 

 

解决思路

找不到模块错误:没有名为“engine”的模块

 

 

解决方法

相关文章

Py之pyttsx:pyttsx/pyttsx3的简介、安装、使用方法之详细攻略

1. def init Found at: pyttsx.__init__
2. 
3. def init(driverName=None, debug=False):
4. '''
5.     Constructs a new TTS engine instance or reuses the existing instance for
6.     the driver name.
7.     
8.     @param driverName: Name of the platform specific driver to use. If
9.     None, selects the default driver for the operating system.
10.     @type: str
11.     @param debug: Debugging output enabled or not
12.     @type debug: bool
13.     @return: Engine instance
14.     @rtype: L{engine.Engine}
15.     '''
16. try:
17.         eng = _activeEngines[driverName]
18. except KeyError:
19.         eng = Engine(driverName, debug)
20.         _activeEngines[driverName] = eng
21. return eng
22. 
23. 
24. class WeakValueDictionary(collections.MutableMapping):
25. """Mapping class that references values weakly.
26. 
27.     Entries in the dictionary will be discarded when no strong
28.     reference to the value exists anymore
29.     """
30. # We inherit the constructor without worrying about the input
31. # dictionary; since it uses our .update() method, we get the right
32. # checks (if the other dictionary is a WeakValueDictionary,
33. # objects are unwrapped on the way out, and we always wrap on the
34. # way in).
35. 
36. def __init__(*args, **kw):
37. if not args:
38. raise TypeError("descriptor '__init__' of 'WeakValueDictionary' "
39. "object needs an argument")
40.         self, *args = args
41. if len(args) > 1:
42. raise TypeError('expected at most 1 arguments, got %d' % len(args))
43. def remove(wr, selfref=ref(self), _atomic_removal=_remove_dead_weakref):
44.             self = selfref()
45. if self is not None:
46. if self._iterating:
47.                     self._pending_removals.append(wr.key)
48. else:
49. # Atomic removal is necessary since this function
50. # can be called asynchronously by the GC
51.                     _atomic_removal(d, wr.key)
52.         self._remove = remove
53. # A list of keys to be removed
54.         self._pending_removals = []
55.         self._iterating = set()
56.         self.data = d = {}
57.         self.update(*args, **kw)
58. 
59. def _commit_removals(self):
60.         l = self._pending_removals
61.         d = self.data
62. # We shouldn't encounter any KeyError, because this method should
63. # always be called *before* mutating the dict.
64. while l:
65.             key = l.pop()
66.             _remove_dead_weakref(d, key)
67. 
68. def __getitem__(self, key):
69. if self._pending_removals:
70.             self._commit_removals()
71.         o = self.data[key]()
72. if o is None:
73. raise KeyError(key)
74. else:
75. return o
76. 
77. def __delitem__(self, key):
78. if self._pending_removals:
79.             self._commit_removals()
80. del self.data[key]
81. 
82. def __len__(self):
83. if self._pending_removals:
84.             self._commit_removals()
85. return len(self.data)
86. 
87. def __contains__(self, key):
88. if self._pending_removals:
89.             self._commit_removals()
90. try:
91.             o = self.data[key]()
92. except KeyError:
93. return False
94. return o is not None
95. 
96. def __repr__(self):
97. return "<%s at %#x>" % (self.__class__.__name__, id(self))
98. 
99. def __setitem__(self, key, value):
100. if self._pending_removals:
101.             self._commit_removals()
102.         self.data[key] = KeyedRef(value, self._remove, key)
103. 
104. def copy(self):
105. if self._pending_removals:
106.             self._commit_removals()
107.         new = WeakValueDictionary()
108. for key, wr in self.data.items():
109.             o = wr()
110. if o is not None:
111.                 new[key] = o
112. return new
113. 
114.     __copy__ = copy
115. 
116. def __deepcopy__(self, memo):
117. from copy import deepcopy
118. if self._pending_removals:
119.             self._commit_removals()
120.         new = self.__class__()
121. for key, wr in self.data.items():
122.             o = wr()
123. if o is not None:
124.                 new[deepcopy(key, memo)] = o
125. return new
126. 
127. def get(self, key, default=None):
128. if self._pending_removals:
129.             self._commit_removals()
130. try:
131.             wr = self.data[key]
132. except KeyError:
133. return default
134. else:
135.             o = wr()
136. if o is None:
137. # This should only happen
138. return default
139. else:
140. return o
141. 
142. def items(self):
143. if self._pending_removals:
144.             self._commit_removals()
145. with _IterationGuard(self):
146. for k, wr in self.data.items():
147.                 v = wr()
148. if v is not None:
149. yield k, v
150. 
151. def keys(self):
152. if self._pending_removals:
153.             self._commit_removals()
154. with _IterationGuard(self):
155. for k, wr in self.data.items():
156. if wr() is not None:
157. yield k
158. 
159.     __iter__ = keys
160. 
161. def itervaluerefs(self):
162. """Return an iterator that yields the weak references to the values.
163. 
164.         The references are not guaranteed to be 'live' at the time
165.         they are used, so the result of calling the references needs
166.         to be checked before being used.  This can be used to avoid
167.         creating references that will cause the garbage collector to
168.         keep the values around longer than needed.
169. 
170.         """
171. if self._pending_removals:
172.             self._commit_removals()
173. with _IterationGuard(self):
174. yield from self.data.values()
175. 
176. def values(self):
177. if self._pending_removals:
178.             self._commit_removals()
179. with _IterationGuard(self):
180. for wr in self.data.values():
181.                 obj = wr()
182. if obj is not None:
183. yield obj
184. 
185. def popitem(self):
186. if self._pending_removals:
187.             self._commit_removals()
188. while True:
189.             key, wr = self.data.popitem()
190.             o = wr()
191. if o is not None:
192. return key, o
193. 
194. def pop(self, key, *args):
195. if self._pending_removals:
196.             self._commit_removals()
197. try:
198.             o = self.data.pop(key)()
199. except KeyError:
200.             o = None
201. if o is None:
202. if args:
203. return args[0]
204. else:
205. raise KeyError(key)
206. else:
207. return o
208. 
209. def setdefault(self, key, default=None):
210. try:
211.             o = self.data[key]()
212. except KeyError:
213.             o = None
214. if o is None:
215. if self._pending_removals:
216.                 self._commit_removals()
217.             self.data[key] = KeyedRef(default, self._remove, key)
218. return default
219. else:
220. return o
221. 
222. def update(*args, **kwargs):
223. if not args:
224. raise TypeError("descriptor 'update' of 'WeakValueDictionary' "
225. "object needs an argument")
226.         self, *args = args
227. if len(args) > 1:
228. raise TypeError('expected at most 1 arguments, got %d' % len(args))
229. dict = args[0] if args else None
230. if self._pending_removals:
231.             self._commit_removals()
232.         d = self.data
233. if dict is not None:
234. if not hasattr(dict, "items"):
235. dict = type({})(dict)
236. for key, o in dict.items():
237.                 d[key] = KeyedRef(o, self._remove, key)
238. if len(kwargs):
239.             self.update(kwargs)
240. 
241. def valuerefs(self):
242. """Return a list of weak references to the values.
243. 
244.         The references are not guaranteed to be 'live' at the time
245.         they are used, so the result of calling the references needs
246.         to be checked before being used.  This can be used to avoid
247.         creating references that will cause the garbage collector to
248.         keep the values around longer than needed.
249. 
250.         """
251. if self._pending_removals:
252.             self._commit_removals()
253. return list(self.data.values())


相关文章
ModuleNotFoundError: No module named ‘mmdet.version‘
ModuleNotFoundError: No module named ‘mmdet.version‘
1189 0
|
6月前
Py3 ModuleNotFoundError: No module named ‘Crypto‘;ModuleNotFoundError: No module named Cryptodome‘
Py3 ModuleNotFoundError: No module named ‘Crypto‘;ModuleNotFoundError: No module named Cryptodome‘
44 0
|
2月前
|
Python
ModuleNotFoundError: No module named ‘IPython‘
ModuleNotFoundError: No module named ‘IPython‘
21 0
|
6月前
ModuleNotFoundError: No module named ‘exceptions‘
ModuleNotFoundError: No module named ‘exceptions‘
|
12月前
ModuleNotFoundError: No module named ‘sentencepiece‘
ModuleNotFoundError: No module named ‘sentencepiece‘
151 0
|
12月前
ModuleNotFoundError: No module named ‘pydensecrf‘解决办法
ModuleNotFoundError: No module named ‘pydensecrf‘解决办法
224 0
|
Python
ModuleNotFoundError: No module named ‘pyexpat‘
ModuleNotFoundError: No module named ‘pyexpat‘
174 0
ModuleNotFoundError: No module named 'torchstat'
ModuleNotFoundError: No module named 'torchstat'
327 0
ModuleNotFoundError: No module named 'torchstat'
ModuleNotFoundError: No module named ‘torchversion‘
ModuleNotFoundError: No module named ‘torchversion‘
142 0
|
机器学习/深度学习 数据可视化 TensorFlow
解决ModuleNotFoundError: No module named ‘tensorboardX‘问题
解决ModuleNotFoundError: No module named ‘tensorboardX‘问题
1247 0
解决ModuleNotFoundError: No module named ‘tensorboardX‘问题