python安裝json的方法pip install json 117.477824,34.431231
https://lbs.amap.com/api/amap-ui/demos/amap-ui-districtexplorer/locate
https://lbs.amap.com/api/amap-ui/demos/amap-ui-districtexplorer/locate邊界(GCJ-02坐標)
https://www.opengps.cn/Map/Tools/PickUpGPS_AMap.aspx 高德地圖獲取地圖坐標(GCJ-02坐標)
https://lbs.amap.com/console/show/picker 高德地圖獲取地圖坐標(GCJ-02坐標)
開發指南 https://lbs.amap.com/faq/webservice/webservice-api/poi-search/43253
開發指南
https://lbs.amap.com/faq/webservice/webservice-api/poi-search/43253 開發 > URI API > 開發指南 >
https://lbs.amap.com/faq/webservice/webservice-api/poi-search/43253
https://ditu.amap.com/search?query=%E6%99%AF%E7%82%B9&city=370800&geoobj=116.583955%7C35.40458%7C116.591659%7C35.40905&_src=around&zoom=17 搜索 - 高德地圖
https://ditu.amap.com/search?query=美食&city=370800&geoobj=116.583955%7C35.40458%7C116.591659%7C35.40905&_src=around&zoom=17 搜索 - 高德地圖
https://uri.amap.com/nearby 高德地圖周邊
高德開放平台 | 高德地圖API https://lbs.amap.com/
https://lbs.amap.com/api/uri-api/guide/search/around-search
周邊生活服務頁-搜索相關-開發指南-URI API | 高德地圖API
https://lbs.amap.com/api/javascript-api/summary 概述-地圖 JS API | 高德地圖API
https://lbs.amap.com/demo-center/loca-api 數據可視化 JS API 示例中心
https://console.amap.com/dev/order/invoice 高德控制台
https://console.amap.com/dev/key/app 高德控制台
https://lbs.amap.com/api/loca-api/prod_intro 產品介紹-數據可視化 JS API
https://www.jianshu.com/p/3d99ca41c93d
https://docs.python.org/zh-cn/3.8/tutorial/stdlib.html#dates-and-times
https://www.runoob.com/python3/python3-set.html
https://docs.python.org/zh-cn/3.8/tutorial/stdlib.html#dates-and-times
https://beautifulsoup.readthedocs.io/zh_CN/v4.4.0/#
pip install
pip install selenium
pip install rich
pip install PyQt5
pip install matplotlib
pip install pillow
pip install OpenCV
pip install webdriver
pip install selenium
pip install mysql
pip install numpy
pip install PyOpenGL
pip install httphttpclient
pip install requests
pip install pygame
pip install json
pip install httpclient
pip install DBUtils
pip install xlrd
pip install xlwt
pip install pandas
pip install cx_Oracle
pip install xlutils
pip install simplejson
pip install requests
pip install PrettyTable
pip install PrettyTable
pip install PrettyTable
pip install PrettyTable
開發環境:windows10、Python3.5、DJango1.11.1
第一步:首先,下載對應simplejson的 .whl文件,下載地址:http://www.lfd.uci.edu/~gohlke/pythonlibs/#simplejson
第二步:打開cmd,進入到Python安裝目錄的Scripts文件夾中.比如:D:\Program Files\Python\Scripts。使用pip安裝剛剛下載好的whl文件,pip.exe install *.whl,例如:
pip.exe install D:\python\simplejson-3.10.0-cp36-cp36m-win_amd64.whl
顯示版本和路徑
pip --version
獲取幫助
pip --help
升級 pip
pip install -U pip
如果這個升級命令出現問題 ,可以使用以下命令:
sudo easy_install --upgrade pip
安裝包
pip install SomePackage # 最新版本
pip install SomePackage==1.0.4 # 指定版本
pip install 'SomePackage>=1.0.4' # 最小版本
比如我要安裝 Django。用以下的一條命令就可以,方便快捷。
pip install Django==1.7
升級包
pip install --upgrade SomePackage
升級指定的包,通過使用==, >=, <=, >, < 來指定一個版本號。
卸載包
pip uninstall SomePackage
搜索包
pip search SomePackage
列出已安裝的包
pip list
查看可升級的包
pip list -o
pip 升級
Linux 或 macOS
pip install --upgrade pip # python2.x
pip3 install --upgrade pip # python3.x
Windows 平台升級:
python -m pip install -U pip # python2.x
python -m pip install -U pip # python3.x
pip 清華大學開源軟件鏡像站
使用國內鏡像速度會快很多:臨時使用:
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple some-package
例如,安裝 Django:pip install -i https://pypi.tuna.tsinghua.edu.cn/simple Django
如果要設為默認需要升級 pip 到最新的版本 (>=10.0.0) 后進行配置:
pip install pip -U
pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
如果您到 pip 默認源的網絡連接較差,臨時使用本鏡像站來升級 pip:
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple pip -U
注意事項
如果 Python2 和 Python3 同時有 pip,則使用方法如下:
Python2:python2 -m pip install XXX
Python3: python3 -m pip install XXX
python中的json解釋庫有好幾個,不同版本使用方法不同。
常用有 json-py 與smiplejson 兩個包
其中,json-py 包含json.py外,還有一個minjson,兩者用法上有差別:
import一樣,import json # 都是如此import的。
import minjson
# json-py庫用法
json.read( json_obj )# Converting JSON to Python
json.write(python_obj)# Converting Python to JSON
#json的minjson用法
minjson.read( json_obj )#同上
minjson.write(python_obj)
# smiplejson 的用法
json.loads(json_obj) # Converting JSON to Python
json.dumps(python_obj)# Converting Python to JSON
python2.5沒有內置的json,要手動安裝。我們現在使用的是 json-py3.4
python2.6內置json解釋庫,是 smiplejson
smiplejson 2.09 下載 http://pypi.python.org/pypi/simplejson/
json-py 3.4 下載 http://sourceforge.net/projects/json-py/files/
經過我測試兩者的效率,發現
python2.5.4, XP下,1K次讀/寫結果如下:
------------------------------------------------------------
minjosn : 1.0737601508
json : 4.49144874205
simplejson: 0.24600865082
---------------------------------------------------------------
python2.5.4, centOS5.3 (lniux)下:
minjosn : 1.8272049427
json : 8.26148796082
simplejson: 3.87293195724
-------------------------------------------------------------
以上令我不解的是XP下速度會比lniux快??
附上測試腳本
,希望有人在不同機子上測試結果帖上來。。。
[python] view plaincopy
1.#coding:utf8
2.import timeit
3.import json
4.import minjson
5.import simplejson
6.js_obj = ''''' ["我是中文",
7. {
8. "bar":["測試阿", null, 1.0, 2], "bool":true
9. }]'''
10.py_obj= [u"我是中文",
11. {
12. "bar":[u"測試阿", None, 1.0, 2], "bool":True
13. }]
14.def test_minjson():
15. minjson.read(js_obj) #可注釋其中一句,單測讀/寫
16. minjson.write(py_obj)
17.def test_json():
18. json.read(js_obj) #可注釋其中一句,單測讀/寫
19. json.write(py_obj)
20.
21.def test_smpjson():
22. simplejson.loads(js_obj)
23. simplejson.dumps(py_obj)
24.if __name__=='__main__':
25.
26. from timeit import Timer
27.
28. t = Timer("test_minjson()", "from __main__ import test_minjson")
29. print 'minjosn :', t.timeit(number = 10000) # 默認number = 100萬次
30.
31. t = Timer("test_json()", "from __main__ import test_json")
32. print 'json :', t.timeit(number = 10000) # 默認number = 100萬次
33.
34. t = Timer("test_smpjson()", "from __main__ import test_smpjson")
35. print 'simplejson:', t.timeit(number = 10000) # 默認number = 100萬次
附錄
python從web接口上查詢信息
>>> import urllib
>>> url='http://a.bkeep.com/page/api/saInterface/searchServerInfo.htm?serviceTag=729HH2X'
>>> page=urllib.urlopen(url)
>>> data=page.read()
>>> print data //這個就是json的數據結構,str類型
like {“xx”:“xx”}
>>> type(data)
<type 'str'>
解析json:
>>> import json
>>> ddata=json.read(data)
>>> type(ddata)
<type 'dict'>
學習 TensorFlow 建議 Python 使用 3.6 學習圖像處理 建議使用 3.5
安裝 OpenGL :
# pip install PyOpenGL
安裝 OpenCV :
# pip install opencv-python
安裝 pygame ( Python 3.5 x64 ):
下載 wheel 文件:
https://files.pythonhosted.org/packages/0b/8c/109e25163da7144c0767b33d41d4674c4aa8cb88d18aa29fc02341f3981a/pygame-1.9.3-cp35-cp35m-win_amd64.whl
# pip install D:\Python\pygame-1.9.3-cp35-cp35m-win_amd64.whl
安裝 dlib ( 1.8 ) :
下載 wheel 文件:
https://files.pythonhosted.org/packages/30/91/ffef19ef1dcbe36fa1fd3d1e01e7cf8177a9edd1a13f51877f8f4623c132/dlib-18.17.100-cp35-none-win_amd64.whl
# pip install D:\Python\dlib-18.17.100-cp35-none-win_amd64.whl
安裝 TensorFlow ( 1.8.0 ) :
注意: 使用 Python 3.6
下載 wheel 文件:
https://raw.githubusercontent.com/fo40225/tensorflow-windows-wheel/master/1.8.0/py36/CPU/sse2/tensorflow-1.8.0-cp36-cp36m-win_amd64.whl
# pip install D:\Python\tensorflow-1.8.0-cp36-cp36m-win_amd64.whl
安裝 matplotlib (數學用, 圖形展示工具):
# pip install matplotlib
如果報錯: module 'matplotlib' has no attribute 'verbose' 就使用:
# pip install matplotlib==2.1.0
安裝 pandas (操作 CSV, Excel 等):
# pip install pandas
安裝 pillow ( Python 圖片操作工具包 PIL ) :
# pip install pillow
安裝 openslide ( Python 操作讀取大圖像工具包, 幾百M, 或者上G ):
# pip install openslide-python
安裝 QT ( Python 圖形界面 ):
# pip install PyQt5
https://www.opengps.cn/Map/Tools/PickUpGPS_AMap.aspx 高德地圖獲取地圖坐標(GCJ-02坐標) - openGPS.cn
二十里鋪
鼠標點擊坐標(Lng,Lat):116.466567,35.521646
石橋
鼠標點擊坐標(Lng,Lat):116.725432,35.298072
內環高架
鼠標點擊坐標(Lng,Lat):116.655051,35.439592
鼠標點擊坐標(Lng,Lat):116.532142,35.350594
https://www.jianshu.com/p/3d99ca41c93d
https://docs.python.org/zh-cn/3.8/tutorial/stdlib.html#dates-and-times
https://www.runoob.com/python3/python3-set.html
https://docs.python.org/zh-cn/3.8/tutorial/stdlib.html#dates-and-times
https://beautifulsoup.readthedocs.io/zh_CN/v4.4.0/#
行政區域查詢是一類簡單的HTTP接口,根據用戶輸入的搜索條件可以幫助用戶快速的查找特定的行政區域信息。
准備:
- key(“Web服務API”密鑰)
請求地址:
-
https://restapi.amap.com/v3/config/district
請求參數:
- key(“Web服務API”密鑰)
- keywords——安徽
- subdistrict——2(可選值:0、1、2、3; 0:不返回下級行政區,1:返回下一級行政區,2:返回下兩級行政區,3:返回下三級行政區。)
- extensions——base(可選值:base、all; base:不返回行政區邊界坐標點;all:只返回當前查詢district的邊界值,不返回子節點的邊界值。)
實際操作:
- java代碼
//這里使用main方法測試是否成功 public static void main(String[] args) { String keyName = "****************";//這里是key名稱 String keyCode = "***************************";//這個是秘鑰 String admAddress = "https://restapi.amap.com/v3/config/district"; Map<String, Object> params = new HashMap<>(); params.put( "key", keyCode); params.put( "keywords", "安徽"); params.put( "subdistrict", 1); params.put( "extensions", "base"); String result = HttpClientUtil.doGet(admAddress, params); System.out.println(result); }
- 運行結果
注意:
- main方法里面用的HttpClientUtil工具類,可借鑒我的這篇博客:java實現小程序獲取二維碼(接口B),里面有詳細的介紹
- 這里只是簡單的實際操作,不懂得可以借鑒高德地圖官方API
color 1
color 2
color 3
python.exe -m pip install --upgrade pip
python -m pip install --upgrade pip
pip install cx-freeze
cx-freeze -h
cxfeeeze -h
cxfreeze.exe --version
pip install rich
pip install selenium
pip install requests
pip install json
pip install time
pip install datetime
pip install json
pip install pathlib
pip install selenium
pip install difflib
pip install selenium
pip install rich
pip install PyQt5
pip install matplotlib
pip install pillow
pip install OpenCV
pip install webdriver
pip install selenium
pip install mysql
pip install numpy
pip install PyOpenGL
pip install httphttpclient
pip install requests
pip install pygame
pip install json
pip install httpclient
pip install DBUtils
pip install xlrd
pip install xlwt
pip install pandas
pip install cx_Oracle
pip install xlutils
pip install simplejson
pip install requests
pip install PrettyTable
python.exe xxqg.py
color a
color b
color c
@pause
exit
exit
selenium
color 1
color 2
color 3
python.exe -m pip install --upgrade pip
python -m pip install --upgrade pip
pip install cx-freeze
cx-freeze -h
cxfeeeze -h
cxfreeze.exe --version
pip install rich
pip install selenium
pip install requests
pip install json
pip install time
pip install datetime
pip install json
pip install pathlib
pip install selenium
pip install difflib
pip install selenium
pip install rich
pip install PyQt5
pip install matplotlib
pip install pillow
pip install OpenCV
pip install webdriver
pip install selenium
pip install mysql
pip install numpy
pip install PyOpenGL
pip install httphttpclient
pip install requests
pip install pygame
pip install json
pip install httpclient
pip install DBUtils
pip install xlrd
pip install xlwt
pip install pandas
pip install cx_Oracle
pip install xlutils
pip install simplejson
pip install requests
pip install PrettyTable
python.exe xxqg.py
color a
color b
color c
@pause
exit
exit
https://saas.51cto.com/learner.html#/mine/schedule https://saas.51cto.com/learner.html#/mine/schedule https://saas.51cto.com/?redirect=https%3A%2F%2Fsaas.51cto.com%2Flearner.html#/login https://saas.51cto.com/?redirect=https%3A%2F%2Fsaas.51cto.com%2Flearner.html#/login 51ctoYQ已經關閉,請學員轉移新平台學習新項目內容。新平台地址為:https://saas.51cto.com ,請使用手機號郵箱登錄88登錄后請馬上修改。
nj1017- https://b.edu.51cto.com/frontadmin/index.html?bus_domain=unicom&bus_id=364#/login
https://b.edu.51cto.com/frontadmin/index.html?bus_domain=unicom&bus_id=364#/login