简体   繁体   English

出现ImportError:执行python manage.py syncdb时没有名为azure.storage.blob的模块

[英]Getting ImportError: No module named azure.storage.blob when doing python manage.py syncdb

When I try to do python manage.py syncdb in my Django app, I get the error ImportError: No module named azure.storage.blob . 当我尝试在Django应用中执行python manage.py syncdb时,出现错误ImportError:没有名为azure.storage.blob的模块 But thing is, the following packages are installed if one does pip freeze : 但事实是,如果进行pip freeze则会安装以下软件包:

azure-common==1.0.0 azure-mgmt==0.20.1 azure-mgmt-common==0.20.0 azure-mgmt-compute==0.20.0 azure-mgmt-network==0.20.1 azure-mgmt-nspkg==1.0.0 azure-mgmt-resource==0.20.1 azure-mgmt-storage==0.20.0 azure-nspkg==1.0.0 azure-servicebus==0.20.1 azure-servicemanagement-legacy==0.20.1 azure-storage==0.20.3

Clearly azure-storage is installed, as is evident. 很明显,显然已经安装了天蓝色存储 Why is azure.storage.blob not available for import? 为什么azure.storage.blob无法导入? I even went into my .virtualenvs directory, and got in all the way to azure.storage.blob (ie ~/.virtualenvs/myvirtualenv/local/lib/python2.7/site-packages/azure/storage/blob$ ). 我什至进入我的.virtualenvs目录,并通向azure.storage.blob (即~/.virtualenvs/myvirtualenv/local/lib/python2.7/site-packages/azure/storage/blob$ )。 It exists! 它存在!

What do I do? 我该怎么办? This answer here has not helped: Install Azure Python api on linux: importError: No module named storage.blob 这里的答案没有帮助: 在Linux上安装Azure Python api:importError:没有名为storage.blob的模块

Note: please ask for more information in case you need it 注意:如果需要,请询问更多信息

I had a similar issue. 我有一个类似的问题。 To alleviate that, I followed this discussion here: https://github.com/Azure/azure-storage-python/issues/51#issuecomment-148151993 为了缓解这种情况,我在这里关注了此讨论: https : //github.com/Azure/azure-storage-python/issues/51#issuecomment-148151993

Basically, try pip install azure==0.11.1 before trying syncdb , and I'm confident it will work for you! 基本上,在尝试syncdb之前尝试pip install azure==0.11.1 ,我相信它将为您服务!

There is a thread similar with yours, please check my answer for the thread Unable to use azure SDK in Python . 有一个与您相似的线程,请检查我的答案以了解无法在Python中使用azure SDK的线程。

Based on my experience, Python imports the third-party library packages from some library paths that you can check them thru codes import sys & sys.path in the python interpreter. 根据我的经验,Python从某些库路径中import sys第三方库包,您可以通过代码在python解释器中import syssys.path来检查它们。 So you can try to dynamically add the new path contains the installed azure packages into the sys.path in the Python runtime to solve the issue. 因此,您可以尝试在Python运行时中将包含已安装的azure软件包的新路径动态添加到sys.path中,以解决此问题。 For adding the new library path, you just code sys.path.append('<the new paths you want to add>') at the front of the code like import azure . 要添加新的库路径,您只需在代码的sys.path.append('<the new paths you want to add>')import azure sys.path.append('<the new paths you want to add>')编写sys.path.append('<the new paths you want to add>')

If the way has not helped, I suggest you can try to reinstall Python environment. 如果该方法没有帮助,建议您尝试重新安装Python环境。 On Ubuntu, you can use the command sudo apt-get remove python python-pip & sudo apt-get install python python-pip to reinstall Python 2.7 & pip 2.7 .(Note: The current major Linux distributions use Python 2.7 as the system default version.) 在Ubuntu上,您可以使用命令sudo apt-get remove python python-pipsudo apt-get install python python-pip重新安装Python 2.7pip 2.7 。(注意:当前的主要Linux发行版使用Python 2.7作为系统默认值版。)

If Python 3.4 as your runtime for Django, the apt package names for Ubuntu are python3 and python3-pip , and you can use sudo pip3 install azure for Python 3.4 on Ubuntu. 如果将Python 3.4作为Django的运行时,则Ubuntu的apt软件包名称为python3python3-pip ,并且您可以在Ubuntu上使用sudo pip3 install azure for Python 3.4

Any concern, please feel free to let me know. 如有任何疑问,请随时告诉我。

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

相关问题 ImportError:没有名为azure.storage.blob的模块 - ImportError: No module named azure.storage.blob 部署时在azure笔记本中出现错误:ImportError:没有名为azure.storage.blob的模块 - Getting error in azure notebooks while deploying : ImportError: No module named azure.storage.blob Python manage.py ImportError:没有名为django的模块 - Python manage.py ImportError: No module named django ImportError:使用manage.py来运行服务器时,没有名为TestModel的模块 - ImportError: No module named TestModel when use manage.py to runserver manage.py - 导入错误:没有名为 django 的模块 - manage.py - ImportError: No module named django ImportError:没有名为toneapp.settings的模块-当我运行python manage.py makemigrations时 - ImportError: No module named toneapp.settings - when i am running python manage.py makemigrations Django manage.py syncdb throw没有名为MySQLdb的模块 - Django manage.py syncdb throwing No module named MySQLdb python manage.py syncdb - python manage.py syncdb python manage.py syncdb失败,显示“配置不正确:没有名为&#39;psycopg2&#39;的模块 - python manage.py syncdb fails with "ImproperlyConfigured: No module named 'psycopg2' python manage.py syncdb错误:没有名为“ south”的模块。 Virtualenvwrapper外部的Django安装称为 - python manage.py syncdb error: No module named south. Django installation outside Virtualenvwrapper called
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM