[英]'ImportError: No module named decorator' in google app engine
I have added a validators library to my google app engine by manually adding the code to a folder lib/validators
.我通过手动将代码添加到文件夹
lib/validators
向我的谷歌应用引擎添加了一个验证器库。 Then in my code I added this line然后在我的代码中我添加了这一行
from validators.utils import ValidationFailure
When I run my app I got an exception from this line:当我运行我的应用程序时,我从这一行得到了一个异常:
from validators.utils import ValidationFailure
File "lib/validators/__init__.py", line 1, in <module>
from .between import between
File "lib/validators/between.py", line 2, in <module>
from .utils import validator
File "lib/validators/utils.py", line 5, in <module>
from decorator import decorator
ImportError: No module named decorator
If I run from decorator import decorator
in the python intrepretor, it works as expected.如果我在 python 解释
from decorator import decorator
中from decorator import decorator
运行,它会按预期工作。
However when I tried it in the 'interactive console' in the local development server, I got the same error但是,当我在本地开发服务器的“交互式控制台”中尝试时,出现了同样的错误
How can I resolve this exception?如何解决此异常?
这对我有用,我专门为Python 3.4安装了装饰器包:
sudo python3.4 -m pip install decorator # specifically Python 3.4
我需要将decorator.py
及其依赖项six.py
到同一个'lib'文件夹中。
对于python3或更高版本,请使用
sudo apt-get install python3-decorator
If you're using anaconda
, the best approach is to install it through conda install decorator
.如果您使用
anaconda
,最好的方法是通过conda install decorator
安装它。
I hope you find it useful.希望对你有帮助。
I create the symbolic links like previous answer said, but doesn't work for me. 我像之前的回答一样创建了符号链接,但对我来说不起作用。 I have to download the source package
我必须下载源包
https://pypi.python.org/pypi/decorator#downloads https://pypi.python.org/pypi/decorator#downloads
and I have reinstalled it manually "$ python setup.py install" 我已手动重新安装它“$ python setup.py install”
And It worked 它奏效了
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.