2016-04-21 90 views
0

我想通過Udacity學習Python,並且本章的主題是Twilio。我通過終端安裝Twilio的建議:在Mac上的Python-Twilio安裝問題?

Tonys-MacBook-Pro:Versions tonychu$ sudo easy_install twilio 
Password: 
Searching for twilio 
Best match: twilio 6.3.dev0 
Processing twilio-6.3.dev0-py2.7.egg 
twilio 6.3.dev0 is already the active version in easy-install.pth 
Using /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site- packages/twilio-6.3.dev0-py2.7.egg 
Processing dependencies for twilio 
Finished processing dependencies for twilio 

結果表明,它已成功安裝,但是當我試圖導入twilio throught IDLE,建議不然。無論如何,我能解決這個問題?謝謝。

Python 2.7.10 (v2.7.10:15c95b7d81dc, May 23 2015, 09:33:12) 
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin 
Type "copyright", "credits" or "license()" for more information. 
>>> WARNING: The version of Tcl/Tk (8.5.9) in use may be unstable. 
Visit http://www.python.org/download/mac/tcltk/ for current information. 

>>> import twilio 
>>> print(twilio.__version__) 
6.3.dev0 
>>> ================================ RESTART ================================ 
>>> 

Traceback (most recent call last): 
    File "/Users/tonychu/Documents/Programming/Python/send_text.py", line 1, in  <module> 
    from twilio.rest import TwilioRestClient 
    File "/Users/tonychu/Documents/Programming/Python/twilio.py", line 2, in <module> 
    print(twilio.__version__) 
AttributeError: 'module' object has no attribute '__version__' 
>>> 

回答

0

Twilio開發人員傳道這裏。

我建議使用pip如下安裝Twilio:

pip install twilio 

如果你不具備畫中畫安裝,你可以運行在終端如下:

wget https://bootstrap.pypa.io/get-pip.py 
python get-pip.py 

安裝Twilio那麼你將有後最新版本的穩定版Twilio library,截至撰寫時爲5.4.0。但你可以隨時檢查最新版本here

讓我知道這是否對你有幫助。

+0

你好,謝謝你的回覆。我已經運行'sudo easy_install pip'和'sudo pip install twilio',但我仍然面臨着運行該程序的相同問題。是否有可能通過電子郵件或Skype與您聯繫? –

+0

當然,請給我發電子郵件[email protected] –