简体   繁体   English

fabfile.py无效:没有名为Crypto的模块

[英]fabfile.py not working: No module named Crypto

I was following this tutorial , and reached the section on using Fabric to deploy django projects. 我正在学习本教程 ,并且到达了使用Fabric来部署django项目的部分。 However when I run my fabfile.py I get this error . 但是,当我运行fabfile.py时,我收到此错误 And here is my fabfile.py. 是我的fabfile.py。 For what i can deduce the Crypto library is missing, by I've tried pip install Crypto and still get the same error. 对于我可以推断出Crypto库的缺失,我已经尝试了pip install Crypto并仍然得到相同的错误。 Any suggestions? 有什么建议? Thanks. 谢谢。

It could be that when you installed it, it didn't compile all the necessary files. 可能是当你安装它时,它没有编译所有必要的文件。 Try re-installing again. 请尝试重新安装。 Make sure you see no errors, if you do you might be missing some development files/headers. 确保您没有看到任何错误,如果您这样做,您可能会遗漏一些开发文件/标题。

pip uninstall pycrypto
pip install pycrypto

You can just test it from the python shell: 你可以从python shell测试它:

python

Then: 然后:

>>> import Crypto

If you don't see any errors you are good. 如果你没有看到任何错误,你就是好人。

If for some reason the module got compiled as crypto instead of Crypto on the Mac you can try: 如果由于某种原因,模块在Mac上编译为加密而不是加密,您可以尝试:

>> import crypto
>> import sys
>> sys.modules['Crypto'] = crypto

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM