python327
Ⅰ python中我用pyinstaller打包的exe文件打不開,報錯如下 是什麼問題啊 F
被打包的文件:helloworld.py, 人人皆知.
打包的命令:pyinstaller -D helloworld.py
打包的console提示: 見隨後的引述塊
打包發布exe時的紀律(注意事項):
很簡單的py腳本. Simple is better than complex. 應該遵守Python的規則.
所以在打包為exe時, 應該盡量減少沒有必要的python包的導入. 否則吃的太胖
可以運行的exe文件位於:dist目錄下, 而不是build目錄下的.
運行後的結果:
- D:DBfz>pyinstaller -D helloworld.py155 INFO: PyInstaller: 3.2.1155 INFO: Python: 2.7.11155 INFO: Platform: Windows-XP-5.1.2600-SP3155 INFO: wrote D:DBfzhelloworld.spec155 INFO: UPX is not available.155 INFO: Extending PYTHONPATH with paths
- ['D:\DB', 'D:\DB\fz']155 INFO: checking Analysis155 INFO: Building Analysis because out00-Analysis.toc is non existent155 INFO: Initializing mole dependency graph...155 INFO: Initializing mole graph hooks...312 INFO: running Analysis out00-Analysis.toc327 INFO: Adding Microsoft.VC90.CRT to dependent assemblies of final executable required by d:anaconda2python.exe327 INFO: Found C:WINDOWSWinSxSPoliciesx86_policy.9.0.Microsoft.VC90.CRT_1fc8b3b9a1e18e3b_x-ww_b7353f759.0.30729.1.policy327 INFO: Searching for assembly x86_Microsoft.VC90.CRT_1fc8b3b9a1e18e3b_9.0.30729.1_x-ww ...327 INFO: Found manifest C:WINDOWSWinSxSManifestsx86_Microsoft.VC90.CRT_1fc8b3b9a1e18e3b_9.0.30729.1_x-ww_6f74963e.manifest327 INFO: Searching for file msvcr90.dll327 INFO: Found file C:WINDOWSWinSxSx86_Microsoft.VC90.CRT_1fc8b3b9a1e18e3b_9.0.30729.1_x-ww_6f74963emsvcr90.dll327 INFO: Searching for file msvcp90.dll327 INFO: Found file C:WINDOWSWinSxSx86_Microsoft.VC90.CRT_1fc8b3b9a1e18e3b_9.0.30729.1_x-ww_6f74963emsvcp90.dll327 INFO: Searching for file msvcm90.dll343 INFO: Found file C:WINDOWSWinSxSx86_Microsoft.VC90.CRT_1fc8b3b9a1e18e3b_9.0.30729.1_x-ww_6f74963emsvcm90.dll343 INFO: Found C:WINDOWSWinSxSPoliciesx86_policy.9.0.Microsoft.VC90.CRT_1fc8b3b9a1e18e3b_x-ww_b7353f759.0.30729.1.policy343 INFO: Adding redirect Microsoft.VC90.CRT version (9, 0, 21022, 8) -> (9, 0,30729, 1)484 INFO: Caching mole hooks...500 INFO: Analyzing D:DBfzhelloworld.py500 INFO: Loading mole hooks...500 INFO: Loading mole hook "hook-encodings.py"...5405 INFO: Loading mole hook "hook-httplib.py"...5421 INFO: Looking for ctypes DLLs5437 INFO: Analyzing run-time hooks ...5452 INFO: Looking for dynamic libraries6155 INFO: Looking for eggs6155 INFO: Using Python library d:anaconda2python27.dll6171 INFO: Found binding redirects:[BindingRedirect(name=u'Microsoft.VC90.CRT', language=None, arch=u'x86', oldVersion=(9, 0, 21022, 8), newVersion=(9, 0, 30729, 1), publicKeyToken=u'1fc8b3b9a1e18e3b')]6187 INFO: Warnings written to D:DBfzuildhelloworldwarnhelloworld.txt6280 INFO: checking PYZ6296 INFO: Building PYZ because out00-PYZ.toc is non existent6296 INFO: Building PYZ (ZlibArchive) D:DBfzuildhelloworldout00-PYZ.pyz6968 INFO: Building PYZ (ZlibArchive) D:DBfzuildhelloworldout00-PYZ.pyz completed successfully.7062 INFO: checking PKG7062 INFO: Building PKG because out00-PKG.toc is non existent7077 INFO: Building PKG (CArchive) out00-PKG.pkg7125 INFO: Building PKG (CArchive) out00-PKG.pkg completed successfully.7140 INFO: Bootloader d:anaconda2libsite-packagesPyInstallerootloaderWindows-32bit un.exe7140 INFO: checking EXE7155 INFO: Building EXE because out00-EXE.toc is non existent7155 INFO: Building EXE from out00-EXE.toc7171 INFO: Appending archive to EXE D:DBfzuildhelloworldhelloworld.exe7171 INFO: Building EXE from out00-EXE.toc completed successfully.7187 INFO: checking COLLECT7202 INFO: Building COLLECT because out00-COLLECT.toc is non existent7202 INFO: Building COLLECT out00-COLLECT.toc7218 INFO: Redirecting Microsoft.VC90.CRT version (9, 0, 21022, 8) -> (9, 0, 30729, 1)7375 INFO: Redirecting Microsoft.VC90.CRT version (9, 0, 21022, 8) -> (9, 0, 30729, 1)7390 INFO: Updating manifest in C:Documents and Datapyinstallerincache00_py27_32bitpython27.dll7405 INFO: Updating resource type 24 name 2 language 10337468 INFO: Redirecting Microsoft.VC90.CRT version (9, 0, 21022, 8) -> (9, 0, 30729, 1)7484 INFO: Updating manifest in C:Documents and Datapyinstallerincache00_py27_32bitunicodedata.pyd7500 INFO: Updating resource type 24 name 2 language 10337546 INFO: Redirecting Microsoft.VC90.CRT version (9, 0, 21022, 8) -> (9, 0, 30729, 1)7562 INFO: Updating manifest in C:Documents and Datapyinstallerincache00_py27_32bit\_hashlib.pyd7562 INFO: Updating resource type 24 name 2 language 10337609 INFO: Redirecting Microsoft.VC90.CRT version (9, 0, 21022, 8) -> (9, 0, 30729, 1)7625 INFO: Updating manifest in C:Documents and Datapyinstallerincache00_py27_32bit\_ctypes.pyd7640 INFO: Updating resource type 24 name 2 language 10337687 INFO: Redirecting Microsoft.VC90.CRT version (9, 0, 21022, 8) -> (9, 0, 30729, 1)7702 INFO: Updating manifest in C:Documents and Datapyinstallerincache00_py27_32bit\_ssl.pyd7718 INFO: Updating resource type 24 name 2 language 10337812 INFO: Redirecting Microsoft.VC90.CRT version (9, 0, 21022, 8) -> (9, 0, 30729, 1)7827 INFO: Updating manifest in C:Documents and Datapyinstallerincache00_py27_32bit\_socket.pyd7843 INFO: Updating resource type 24 name 2 language 10337875 INFO: Redirecting Microsoft.VC90.CRT version (9, 0, 21022, 8) -> (9, 0, 30729, 1)7890 INFO: Updating manifest in C:Documents and Datapyinstallerincache00_py27_32bitselect.pyd7905 INFO: Updating resource type 24 name 2 language 10337952 INFO: Redirecting Microsoft.VC90.CRT version (9, 0, 21022, 8) -> (9, 0, 30729, 1)7968 INFO: Updating manifest in C:Documents and Datapyinstallerincache00_py27_32bitz2.pyd7968 INFO: Updating resource type 24 name 2 language 10338046 INFO: Building COLLECT out00-COLLECT.toc completed successfully.D:DBfz>
Ⅱ python中**是啥什麼意思
1、兩個值相加,然後返回值給符號左側的變數
舉例如下:
>>> a=1
>>> b=3
>>> a+=b(或者a+=3)
>>> a
4
2、用於字元串連接(變數值帶引號,數據類型為字元串)
>>> a='1'
>>> b='2'
>>> a+=b
>>> a
'12'
8、運算符優先順序
以下所列優先順序順序按照從低到高優先順序的順序;同行為相同優先順序。
Lambda #運算優先順序最低
邏輯運算符: or
邏輯運算符: and
邏輯運算符:not
成員測試: in, not in
同一性測試: is, is not
比較: <,<=,>,>=,!=,==
按位或: |
按位異或: ^
按位與: &
移位: << ,>>
加法與減法: + ,-
乘法、除法與取余: *, / ,%
正負號: +x,-x
具有相同優先順序的運算符將從左至右的方式依次進行,用小括弧()可以改變運算順序。
參考資料來源:網路-Python
Ⅲ 美國ba專業排名大學有哪些
1、MIT——BA
MIT的BA項目2016年秋季開設,2018屆的class size 30人,錄取者的平均GPA達到了3.9+,GRE
quant部分168+,平均工作經驗0-2年。超過80%以上的學生具有科學、數學、工程、計算機的專業背景。如果是文商社科專業的申請同學,建議一定補充CS語言和編程類的課程,其次,GT成績爭取刷到110+和750+或330+,才會有競爭力。M根據官網上提供的信息,錄取者的本科大多出自名校,如Berkeley、brown、combridge、ke、Harvard、Stanford等,如果本科學校非985、211的同學,我們不建議申請。
2、UT Austin——BA
UT的BA項目隸屬於McCombs商學院,為期僅10個月,夏季入學,次年夏季畢業。UT綜排在美國雖然不算特別高,但是McCombs商學院在德州可以說是女神般的存在,畢業生水平在整個美國也是有口皆碑的。項目的課程設置會有三分之一的business課程,包括finance、marketing、supply
chain等方面的知識;三分之一的CS方面的課程,目前主要是Java和資料庫;另外三分之一是stats的課程。這樣的設置基本涵蓋了做BA所需要的skillsets,到畢業的時候Java、Python、Hadoop、SAS、R、Matlab、sql等這些基本的技能應該都能掌握了。
這個學校的項目喜歡錄取有理工科背景的申請者,項目size50-60人左右,中國學生10人左右,畢竟UT是個以白哥白姐為主的學校,因此不會像UCLA、USC等出現大規模的中國人。2017屆的錄取平均GPA3.61,GMAT719,數學和統計的相關課程分數高的申請者錄取幾率較大。項目就業率100%,一是項目本身有capstone,可以和大企業合作(walmart、visa、home
depot、Dell、IBM、intel等)以及當地的傳統和咨詢公司(四大);二是UT的商學院校友資源豐富,找工作的時候往屆校友非常樂意幫助新畢業的學弟學妹們。
3、USC--BA
USC的BA隸屬於Marshall school of
business,於2014年開設,在加州的BA中可以說是元老級別,因此無論是課程設置還是校友資源、業界聯系可以說是目前比較成熟的體系。USC的BA項目是一個為期18個月的課程,但是大部分中國學生選擇延長到兩年,以更好地適應項目。33credit的畢業學分要求裡面,19.5是必修,13.5是選修,如果本科修過某個特定課程的情況下,必修課程也可以waive掉換成相應的選修課程。項目的課程分為三類:general
BA,常規的BA課程設置;statistical learning
method,適合想往finance和consulting方向發展的同學;statistics modeling,適合想往更tech方向發展的同學。
USC位於LA
downtown,占據地利但也絕不限於LA地區,往屆畢業的學長學姐也有很多relocate去別的地區。USC的中國同學是不少的,課程上、畢業後都可有大量的校友資源可以使用。這個學校喜歡錄取GT分數高的,2016年的錄取學生平均GPA達到3.63,GMAT722+,GRE320+。如果申請人又在四大或是其他big
name的公司實習或者工作過,也是個大優勢。USC並不卡申請者的本科學校,有很多國內211、985,一些普通美本的同學就讀,因此感興趣的同學們GPA、GT分數夠高的話,都是很有希望的。
4、Fordham--BA
福特漢姆大學位於紐約曼哈頓中心,地利位置極好,紐約市有很多世界知名公司和企業,對於畢業後想在當地找實習和工作的同學來說是個巨大的優勢。2017級項目有70個人,中國學生比重高達80%,多數人本科是學會計和金融的。TG成績需要100+和320+,項目對申請者的技術背景要求不高,成績達到了基本錄取線希望是很大的,申請時上過statistics、forecasting、modeling等課程可以加分。需要注意的是這個項目的成績提交需要WES認證,同學們需要花一些時間做認證的准備。其次,Fordham的BA項目會有面試,網上也有很多Fordham
BA麵筋總結,這里我們就不展開講了。Fordham大學的教授和學生都很務實,比如大家會相互分享交流面試經驗等,教授也會耐心地解答學生的求職問題,指導找工作等。
5、UMN--BA
UMN的BA碩士開設在其Carlson管理學院下,學制一年,共45學分,一學期要上5門課,curriculum相當intensive。暑假課程集中補習一些programming和data
analysis的知識,包括Python,R的基礎,以確保學生在之後的分析課程中熟練使用。BA項目屬於department of information and
decision science,UMN本身就是MIS和stat強校,再加上carlson管理學院名聲在外也不錯,因此UMN的BA
program的professors有很多大牛,career方面先天優勢十分明顯。根據去年的統計數據,項目有25人,其中大陸本3人,預計2018年會擴招。雖然UMN綜排位於top50之外,可每年依然吸引著眾多的申請者,建議GPA3.5+
T100+ G320+的同學可以申請。
6、GWU--BA
GWU綜排56,商排30+,它的BA是由商學院department of decision
science主導的一個項目,full-time的項目時長10個月,part-time時長可達兩年,項目總共40人左右,中國人大概4-5人。項目的curriculum比較偏應用,但是相關軟體比如R,python,C++等等,同學們還是需要自行掌握。由於優越的地理位置,DC地區有很多私企和世界性組織的實習機會,暑假找到實習的同學還是比較多的,大部分畢業生最後都能在實習的公司留下來。
Ⅳ python2.7中如果腳本文件放在中文目錄下,pymysql連接資料庫會報錯,怎麼解決(不要修改中文目錄名為英文)
解決方法為:
創建數據表時指定charset=utf8,如:
usehongxiudb;
createtableifnotexistshongxiu(
nametext,
authortext,
introtext
)engine=InnoDBdefaultcharset=utf8;
Ⅳ Python AttributeError: '_XMLTestResult' object has no attribute 'skipped'
這個代碼好熟悉。差點兒就以為是我10年前寫的一個自動測試框架了。
應該是你運行的結果有問題。也就是結果這個類XMLTestResult。它少了一個skipped的屬性。
原因應該可能是是代碼版本問題。或者是itersuite里的XMLTestResult的實例的__init__函數里的少了設計skipped這個數組。
你只要打開XMLTestResult這個類檢查一下就可以。如果它是用C++實現的。那麼你自己在構造測試用python類時,自己加一個skipped空數組就可以。
Ⅵ Python裡面的BlockWindow是個什麼東西啊我學wxpython的時候提示no mole named blockwindow
BlockWindow 出現在wx教程wxpython in action書中,關於Sizer部分大量使用到BlockWindow模塊。
這不是一個標准模塊,而是書中之前介紹的一個自定義類,見書中327頁。
源代碼如下:
import wx
class BlockWindow(wx.Panel):
def __init__(self, parent, ID=-1, label=」」, pos=wx.DefaultPosition, size=(100, 25)):
wx.Panel.__init__(self, parent, ID, pos, size, wx.RAISED_BORDER, label)
self.label = label
self.SetBackgroundColour(「white」)
self.SetMinSize(size)
self.Bind(wx.EVT_PAINT, self.OnPaint)
def OnPaint(self, evt):
sz = self.GetClientSize()
dc = wx.PaintDC(self)
w,h = dc.GetTextExtent(self.label)
dc.SetFont(self.GetFont())
dc.DrawText(self.label, (sz.width-w)/2, (sz.height-h)/2)
Ⅶ python pyinstaller問題
打包python腳本為exe的坎坷經歷, by pyinstaller方法
又應驗了那句歌詞. 不經歷風雨, 怎麼見得了彩虹.
安裝過程略去不提, 僅提示: pip install pyinstaller
打包指令
粗看包里的文檔, 然後開始打包:
打開console
就用了這個命令: pyinstaller monitor_rt_quotes.py
結果就是比預期麻煩的多的多的: 幹活, 硬碟不停地balabala叫, 漫長
這里記錄一下控制台顯示的提示信息:Writesmyscript.specin the same folder as the script.
Creates a folderbuildin the same folder as the script if it does not exist.
Writes some log files and working files in thebuildfolder.
Creates a folderdistin the same folder as the script if it does not exist.
Writes themyscriptexecutable folder in thedistfolder.
被打包的文件:helloworld.py, 人人皆知.
打包的命令:pyinstaller -D helloworld.py
打包的console提示: 見隨後的引述塊
打包發布exe時的紀律(注意事項):
很簡單的py腳本. Simple is better than complex. 應該遵守Python的規則.
所以在打包為exe時, 應該盡量減少沒有必要的python包的導入. 否則吃的太胖
可以運行的exe文件位於:dist目錄下, 而不是build目錄下的.
運行後的結果:
- D:DBfz>pyinstaller -D helloworld.py155 INFO: PyInstaller: 3.2.1155 INFO: Python: 2.7.11155 INFO: Platform: Windows-XP-5.1.2600-SP3155 INFO: wrote D:DBfzhelloworld.spec155 INFO: UPX is not available.155 INFO: Extending PYTHONPATH with paths
- ['D:\DB', 'D:\DB\fz']155 INFO: checking Analysis155 INFO: Building Analysis because out00-Analysis.toc is non existent155 INFO: Initializing mole dependency graph...155 INFO: Initializing mole graph hooks...312 INFO: running Analysis out00-Analysis.toc327 INFO: Adding Microsoft.VC90.CRT to dependent assemblies of final executable required by d:anaconda2python.exe327 INFO: Found C:WINDOWSWinSxSPoliciesx86_policy.9.0.Microsoft.VC90.CRT_1fc8b3b9a1e18e3b_x-ww_b7353f759.0.30729.1.policy327 INFO: Searching for assembly x86_Microsoft.VC90.CRT_1fc8b3b9a1e18e3b_9.0.30729.1_x-ww ...327 INFO: Found manifest C:WINDOWSWinSxSManifestsx86_Microsoft.VC90.CRT_1fc8b3b9a1e18e3b_9.0.30729.1_x-ww_6f74963e.manifest327 INFO: Searching for file msvcr90.dll327 INFO: Found file C:WINDOWSWinSxSx86_Microsoft.VC90.CRT_1fc8b3b9a1e18e3b_9.0.30729.1_x-ww_6f74963emsvcr90.dll327 INFO: Searching for file msvcp90.dll327 INFO: Found file C:WINDOWSWinSxSx86_Microsoft.VC90.CRT_1fc8b3b9a1e18e3b_9.0.30729.1_x-ww_6f74963emsvcp90.dll327 INFO: Searching for file msvcm90.dll343 INFO: Found file C:WINDOWSWinSxSx86_Microsoft.VC90.CRT_1fc8b3b9a1e18e3b_9.0.30729.1_x-ww_6f74963emsvcm90.dll343 INFO: Found C:WINDOWSWinSxSPoliciesx86_policy.9.0.Microsoft.VC90.CRT_1fc8b3b9a1e18e3b_x-ww_b7353f759.0.30729.1.policy343 INFO: Adding redirect Microsoft.VC90.CRT version (9, 0, 21022, 8) -> (9, 0,30729, 1)484 INFO: Caching mole hooks...500 INFO: Analyzing D:DBfzhelloworld.py500 INFO: Loading mole hooks...500 INFO: Loading mole hook "hook-encodings.py"...5405 INFO: Loading mole hook "hook-httplib.py"...5421 INFO: Looking for ctypes DLLs5437 INFO: Analyzing run-time hooks ...5452 INFO: Looking for dynamic libraries6155 INFO: Looking for eggs6155 INFO: Using Python library d:anaconda2python27.dll6171 INFO: Found binding redirects:[BindingRedirect(name=u'Microsoft.VC90.CRT', language=None, arch=u'x86', oldVersion=(9, 0, 21022, 8), newVersion=(9, 0, 30729, 1), publicKeyToken=u'1fc8b3b9a1e18e3b')]6187 INFO: Warnings written to D:DBfzuildhelloworldwarnhelloworld.txt6280 INFO: checking PYZ6296 INFO: Building PYZ because out00-PYZ.toc is non existent6296 INFO: Building PYZ (ZlibArchive) D:DBfzuildhelloworldout00-PYZ.pyz6968 INFO: Building PYZ (ZlibArchive) D:DBfzuildhelloworldout00-PYZ.pyz completed successfully.7062 INFO: checking PKG7062 INFO: Building PKG because out00-PKG.toc is non existent7077 INFO: Building PKG (CArchive) out00-PKG.pkg7125 INFO: Building PKG (CArchive) out00-PKG.pkg completed successfully.7140 INFO: Bootloader d:anaconda2libsite-packagesPyInstallerootloaderWindows-32bit un.exe7140 INFO: checking EXE7155 INFO: Building EXE because out00-EXE.toc is non existent7155 INFO: Building EXE from out00-EXE.toc7171 INFO: Appending archive to EXE D:DBfzuildhelloworldhelloworld.exe7171 INFO: Building EXE from out00-EXE.toc completed successfully.7187 INFO: checking COLLECT7202 INFO: Building COLLECT because out00-COLLECT.toc is non existent7202 INFO: Building COLLECT out00-COLLECT.toc7218 INFO: Redirecting Microsoft.VC90.CRT version (9, 0, 21022, 8) -> (9, 0, 30729, 1)7375 INFO: Redirecting Microsoft.VC90.CRT version (9, 0, 21022, 8) -> (9, 0, 30729, 1)7390 INFO: Updating manifest in C:Documents and Datapyinstallerincache00_py27_32bitpython27.dll7405 INFO: Updating resource type 24 name 2 language 10337468 INFO: Redirecting Microsoft.VC90.CRT version (9, 0, 21022, 8) -> (9, 0, 30729, 1)7484 INFO: Updating manifest in C:Documents and Datapyinstallerincache00_py27_32bitunicodedata.pyd7500 INFO: Updating resource type 24 name 2 language 10337546 INFO: Redirecting Microsoft.VC90.CRT version (9, 0, 21022, 8) -> (9, 0, 30729, 1)7562 INFO: Updating manifest in C:Documents and Datapyinstallerincache00_py27_32bit\_hashlib.pyd7562 INFO: Updating resource type 24 name 2 language 10337609 INFO: Redirecting Microsoft.VC90.CRT version (9, 0, 21022, 8) -> (9, 0, 30729, 1)7625 INFO: Updating manifest in C:Documents and Datapyinstallerincache00_py27_32bit\_ctypes.pyd7640 INFO: Updating resource type 24 name 2 language 10337687 INFO: Redirecting Microsoft.VC90
官方文檔對上述指令的解釋為:
|PyInstaller| analyzesmyscript.pyand:
In thedistfolder you find the bundled app you distribute to your users.
巨長的提示後, 得到了exe文件, 有18Mb的大小(太龐大了, 肥肥肥!!!), 但是結果很悲劇:
D:DBfzuildmonitor_rt_quotes>monitor_rt_quotes.exe sz000911
Error loading Python DLL: D:DBfzuildmonitor_rt_quotespython27.dll (error code 126)
估計是沒有添加必要的打包選項造成的. 繼續努力.
不死心! 解決問題需要由簡到繁, 先從hellowworld.py做起. 搞定了.
Ⅷ max retries exceeded with url 怎麼解決
Traceback (most recent call last):
File "thread072413.py", line 163, in <mole>
File "thread072413.py", line 122, in main
File "/usr/local/lib/python2.7/dist-packages/requests/api.py", line 55, in get
File "/usr/local/lib/python2.7/dist-packages/requests/api.py", line 44, in request
File "/usr/local/lib/python2.7/dist-packages/requests/sessions.py", line 335, in request
File "/usr/local/lib/python2.7/dist-packages/requests/sessions.py", line 438, in send
File "/usr/local/lib/python2.7/dist-packages/requests/adapters.py", line 327, in send
requests.exceptions.ConnectionError: HTTPConnectionPool(host='apk.gfan.com', port=80): Max retries exceeded with url: /apps_7_1_78.html (Caused by <class 'socket.gaierror'>: [Errno -2] Name or service not known)
Error in sys.excepthook:
Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/apport_python_hook.py", line 64, in apport_excepthook
ImportError: No mole named fileutils
Original exception was:
Traceback (most recent call last):
File "thread072413.py", line 163, in <mole>
File "thread072413.py", line 122, in main
File "/usr/local/lib/python2.7/dist-packages/requests/api.py", line 55, in get
File "/usr/local/lib/python2.7/dist-packages/requests/api.py", line 44, in request
File "/usr/local/lib/python2.7/dist-packages/requests/sessions.py", line 335, in request
File "/usr/local/lib/python2.7/dist-packages/requests/sessions.py", line 438, in send
File "/usr/local/lib/python2.7/dist-packages/requests/adapters.py", line 327, in send
requests.exceptions.ConnectionError: HTTPConnectionPool(host='apk.gfan.com', port=80): Max retries exceeded with url: /apps_7_1_78.html (Caused by <class 'socket.gaierror'>: [Errno -2] Name or service not known)
Ⅸ Python里import image報錯找不到指定的程序
C:Python34Scripts>pipinstallpillow
Collectingpillow
DownloadingPillow-4.1.0-cp34-cp34m-win32.whl(1.2MB)
100%|████████████████████████████████|1.2MB327kB/s
Collectingolefile(frompillow)
Downloadingolefile-0.44.zip(74kB)
100%|████████████████████████████████|81kB748kB/s
Installingcollectedpackages:olefile,pillow
Runningsetup.pyinstallforolefile...done
Successfullyinstalledolefile-0.44pillow-4.1.0
這邊是3.4,這么裝完沒問題
Ⅹ 用PYTHON2做個計算器,只要加減乘除
# encoding: UTF-8
from Tkinter import *
class App:
def __init__(self,master):
frame=Frame(master)
frame.pack()
self.v = StringVar()
self.v.set(" ")
self.entry1=Entry(frame,text="")
self.entry1.grid(row=0,columnspan=2)
self.label0=Label(frame,text="Answer:").grid(row=1,column=0)
self.label1=Label(frame,textvariable=self.v).grid(row=1,column=1)
self.button1=Button(frame,text=" = ",command=self.inputnumber).grid(row=2)
#self.hi_there.pack(side=LEFT)
def inputnumber(self):
self.v.set(eval(self.entry1.get()))
root=Tk()
app=App(root)
root.mainloop()
以上代碼拷貝下來保存為一個py文件,然後運行就好。
注意沒有任何錯誤檢查的。