老白问个问题是什么原因
dxs1256 opened this issue · comments
dxs1256 commented
[root@Nfp tumblr]# python tumblr.py sylar258
Traceback (most recent call last):
File "tumblr.py", line 6, in
import queue
ImportError: No module named queue
看不懂为什么
zhangcr commented
from multiprocessing import Queue as queue
Aaron commented
`[root@vultr tumblr_spider]# git diff tumblr.py
diff --git a/tumblr.py b/tumblr.py
index 4ebc2fd..b0d8ef6 100644
--- a/tumblr.py
+++ b/tumblr.py
@@ -3,7 +3,11 @@ import signal
import sys
import requests
import threading
-import queue
+is_py2 = sys.version[0] == '2'
+if is_py2:
- import Queue as queue
+else: - import queue as queue
import time
from bs4 import BeautifulSoup
`