1
繼在別人的建議:嘗試安裝請求時,使用urllib3 Given a big list of urls, what is a way to check which are active/inactive?使用urllib3時,遇到了這個奇怪的「無效語法」錯誤/請求
得到錯誤。
試圖安裝請求。
C:\Users\yao\Desktop\My Downloads\requests-develop\requests-develop>setup.py install
Traceback (most recent call last):
File "C:\Users\yao\Desktop\My Downloads\requests-develop\requests-develop\setup.py", line 6, in <module>
import requests
File "C:\Users\yao\Desktop\My Downloads\requests-develop\requests-develop\requests\__init__.py", line 52, in <module>
from . import utils
File "C:\Users\yao\Desktop\My Downloads\requests-develop\requests-develop\requests\utils.py", line 22, in <module>
from .compat import parse_http_list as _parse_list_header
File "C:\Users\yao\Desktop\My Downloads\requests-develop\requests-develop\requests\compat.py", line 95, in <module>
from .packages import chardet
File "C:\Users\yao\Desktop\My Downloads\requests-develop\requests-develop\requests\packages\__init__.py", line 3, in <module>
from . import urllib3
File "C:\Users\yao\Desktop\My Downloads\requests-develop\requests-develop\requests\packages\urllib3\__init__.py", line 16, in <module>
from .connectionpool import (
File "C:\Users\yao\Desktop\My Downloads\requests-develop\requests-develop\requests\packages\urllib3\connectionpool.py", line 434
except Empty as e:
^
SyntaxError: invalid syntax
試圖使用urllib3。
C:\Users\yao\Desktop\ad stuff\find urls>reqs.py
Traceback (most recent call last):
File "C:\Users\yao\Desktop\ad stuff\find urls\reqs.py", line 1, in <module>
import re, csv, urllib3
File "build\bdist.win32\egg\urllib3\__init__.py", line 16, in <module>
File "C:\Python25\lib\site-packages\urllib3-dev-py2.5.egg\urllib3\connectionpool.py", line 435
except Empty as e:
^
SyntaxError: invalid syntax
剛剛安裝了setuptools,pip,requests,urllib3。以該順序。我搞亂了什麼嗎?使用python 2.5 btw。
奇怪的是,我也安裝了python 2.7,但它似乎像所有使用python 2.5,我該如何解決? – iCodeLikeImDrunk
您似乎正在使用Windows。我不知道,所以恐怕我不知道答案。在Linux/Mac OS上,我只是用'python2.7'替換'python'或'python2.5'的每一個引用,無論是在我執行的文件還是我用來執行它的命令。 –
刪除所有舊的東西,增加2.7,工作完美。謝謝! – iCodeLikeImDrunk