Open slinwu opened 7 years ago
你好: 我這裡確認網路正常下,執行是沒有錯誤,如下圖。 另外,請在windows的command視窗, 輸入conda list檢視matplotlib是否已安裝。 若沒有請command 視窗輸入pip matplotlib install, 確認有此套件後再執行
你好:
我確認有安裝此套件 matplotlib 2.0.2 np112py36_0
以下是執行的LOG:
In [20]: runfile('D:/python/finance_demo.py', wdir='D:/python') Traceback (most recent call last):
File "
File "C:\Users\Amanda\Anaconda3\lib\site-packages\spyder\utils\site\sitecustomize.py", line 880, in runfile execfile(filename, namespace)
File "C:\Users\Amanda\Anaconda3\lib\site-packages\spyder\utils\site\sitecustomize.py", line 102, in execfile exec(compile(f.read(), filename, 'exec'), namespace)
File "D:/python/finance_demo.py", line 9, in
File "C:\Users\Amanda\Anaconda3\lib\site-packages\matplotlib\finance.py", line 455, in quotes_historical_yahoo_ohlc ochl=False)
File "C:\Users\Amanda\Anaconda3\lib\site-packages\matplotlib\finance.py", line 503, in _quotes_historical_yahoo fh = fetch_historical_yahoo(ticker, date1, date2, cachename)
File "C:\Users\Amanda\Anaconda3\lib\site-packages\matplotlib\finance.py", line 362, in fetch_historical_yahoo with contextlib.closing(urlopen(url)) as urlfh:
File "C:\Users\Amanda\Anaconda3\lib\urllib\request.py", line 223, in urlopen return opener.open(url, data, timeout)
File "C:\Users\Amanda\Anaconda3\lib\urllib\request.py", line 526, in open response = self._open(req, data)
File "C:\Users\Amanda\Anaconda3\lib\urllib\request.py", line 544, in _open '_open', req)
File "C:\Users\Amanda\Anaconda3\lib\urllib\request.py", line 504, in _call_chain result = func(*args)
File "C:\Users\Amanda\Anaconda3\lib\urllib\request.py", line 1346, in http_open return self.do_open(http.client.HTTPConnection, req)
File "C:\Users\Amanda\Anaconda3\lib\urllib\request.py", line 1320, in do_open raise URLError(err)
URLError: <urlopen error [Errno 11001] getaddrinfo failed>
runfile('D:/python/finance_demo.py', wdir='D:/python') Traceback (most recent call last):
File "
File "C:\Users\Amanda\Anaconda3\lib\site-packages\spyder\utils\site\sitecustomize.py", line 880, in runfile execfile(filename, namespace)
File "C:\Users\Amanda\Anaconda3\lib\site-packages\spyder\utils\site\sitecustomize.py", line 102, in execfile exec(compile(f.read(), filename, 'exec'), namespace)
File "D:/python/finance_demo.py", line 9, in
File "C:\Users\Amanda\Anaconda3\lib\site-packages\matplotlib\finance.py", line 455, in quotes_historical_yahoo_ohlc ochl=False)
File "C:\Users\Amanda\Anaconda3\lib\site-packages\matplotlib\finance.py", line 503, in _quotes_historical_yahoo fh = fetch_historical_yahoo(ticker, date1, date2, cachename)
File "C:\Users\Amanda\Anaconda3\lib\site-packages\matplotlib\finance.py", line 362, in fetch_historical_yahoo with contextlib.closing(urlopen(url)) as urlfh:
File "C:\Users\Amanda\Anaconda3\lib\urllib\request.py", line 223, in urlopen return opener.open(url, data, timeout)
File "C:\Users\Amanda\Anaconda3\lib\urllib\request.py", line 526, in open response = self._open(req, data)
File "C:\Users\Amanda\Anaconda3\lib\urllib\request.py", line 544, in _open '_open', req)
File "C:\Users\Amanda\Anaconda3\lib\urllib\request.py", line 504, in _call_chain result = func(*args)
File "C:\Users\Amanda\Anaconda3\lib\urllib\request.py", line 1346, in http_open return self.do_open(http.client.HTTPConnection, req)
File "C:\Users\Amanda\Anaconda3\lib\urllib\request.py", line 1320, in do_open raise URLError(err)
URLError: <urlopen error [Errno 11001] getaddrinfo failed>
17/8/2 (週三),letylin notifications@github.com 寫道:
主旨: Re: [letylin/pyprogbook] RC_7_3 無法執行 (#19) 收件者: "letylin/pyprogbook" pyprogbook@noreply.github.com 副本: "slinwu" slinwu@yahoo.com.tw, "Author" author@noreply.github.com 日期: 2017年8月2日,三,下午12:53
我這裡確認網路正常下,執行是沒有錯誤,如下圖。
另外,請在windows的command視窗, 輸入conda list檢視matplotlib是否已安裝。 若沒有請command 視窗輸入pip matplotlib install, 確認有此套件後再執行
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.
請問你的程式碼可以貼上來給我測看看, 我這裡沒有問題的。
可能是系統, 軟體環境問題, 能否同一支程式, 在另一台電腦測試過是否也出現同樣問題。程式碼本身應沒有錯。
我直接用你網路上的執行
import matplotlib.pyplot as plt from matplotlib.dates import DateFormatter from matplotlib.finance import quotes_historical_yahoo_ohlc, candlestick_ohlc
start = (2016, 4, 1) end = (2016, 4, 25) weekFormatter = DateFormatter('%b %d') # 例如, Jan 03 2016 quotes = quotes_historical_yahoo_ohlc('AAPL', start, end)
if len(quotes) == 0: raise SystemExit
fig, ax = plt.subplots() ax.xaxis_date() plt.setp(plt.gca().get_xticklabels(), rotation=45, horizontalalignment='right')
candlestick_ohlc(ax, quotes, width=0.6) plt.show()
17/8/2 (週三),letylin notifications@github.com 寫道:
主旨: Re: [letylin/pyprogbook] RC_7_3 無法執行 (#19) 收件者: "letylin/pyprogbook" pyprogbook@noreply.github.com 副本: "slinwu" slinwu@yahoo.com.tw, "Author" author@noreply.github.com 日期: 2017年8月2日,三,下午1:58
可能是系統, 軟體環境問題, 能否同一支程式, 在另一台電腦測試過是否也出現同樣問題。程式碼本身應沒有錯。
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.
我這邊確定可以正常執行。你的anaconda是什麼版本?
你的作業系統與anaconda版本是?
windows8 Python3.6.1 Anaconda 3.4.4.0
17/8/2 (週三),letylin notifications@github.com 寫道:
主旨: Re: [letylin/pyprogbook] RC_7_3 無法執行 (#19) 收件者: "letylin/pyprogbook" pyprogbook@noreply.github.com 副本: "slinwu" slinwu@yahoo.com.tw, "Author" author@noreply.github.com 日期: 2017年8月2日,三,下午2:41
你的作業系統與anaconda版本是?
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.
只差在我是windows7, 我正在測google finance api, 預計下週會測完,下週再分享給你好嗎? 若忘了, 再提醒我。
17/8/2 (週三),letylin notifications@github.com 寫道:
主旨: Re: [letylin/pyprogbook] RC_7_3 無法執行 (#19) 收件者: "letylin/pyprogbook" pyprogbook@noreply.github.com 副本: "slinwu" slinwu@yahoo.com.tw, "Author" author@noreply.github.com 日期: 2017年8月2日,三,下午3:42
只差在我是windows7, 我正在測google finance api, 預計下週會測完,下週再分享給你好嗎? 若忘了, 再提醒我。
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.
github的討論參與者您好! 您在這邊的留言我們比較難在第一時間收到資訊, 所以在這邊邀請您加入我們的LINE@ 1對1聊天群組, 您可以在LINE上討論有關於書中的問題, 讓我們能快速知道您的疑問並與您討論!
LINE@ID:@iex5378o ★☆★使用手機者點選以下網址或使用電腦者掃描以下QRCode立即加入群組★☆★ https://line.me/R/ti/p/%40iex5378o
RC_7_3: 上網抓資料並畫K線圖
執行到 quotes = quotes_historical_yahoo_ohlc('AAPL', start, end) 一直出現URLError: <urlopen error [Errno 11001] getaddrinfo failed>, 請問是什麼問題 ?