1. 程式人生 > >Azure Python SDK安裝及排錯

Azure Python SDK安裝及排錯

Python版本:2.7.6

pip安裝:

pip install --upgrade pip
pip install azure-batch 
pip install azure-mgmt-scheduler
pip install --pre azure-mgmt-compute
pip install --pre azure
pip install msrest
pip install msrestazure

Github原始碼安裝:

git clone git://github.com/Azure/azure-sdk-for-python.git
cd azure-sdk-for
-python python setup.py install

【坑爹的錯誤】
1. msrest錯誤:

Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python2.7/site-packages/azure/common/credentials.py", line 25, in <module>
raise ImportError("You need to install 'msrest' to use this feature"
) ImportError: You need to install 'msrest' to use this feature

排錯步驟及思路:
這種錯誤表面azure在呼叫msrest時,msrest模組產生了錯誤,導致無法正確加在msrest模組。
在確保 msrest和msrestazure已經被安裝的前提下,單獨import msrest發現錯誤如下:

ImportError: No module named packages.urllib3

產生原因:requests版本過低。
解決方法:pip install --upgrade requests

2.ssl錯誤

AttributeError: 'X509'
object has no attribute '_x509'

產生原因:pyopenssl版本過低
解決方法:pip install -U pyOpenSSL