摘要:首先: yum install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gcc make 安装必要的组件 其次:https://www.python.org/dow
阅读全文
摘要:MAC OS 10.11.6 lMacBook-Pro:~ xiaomilbq$ python Python 2.7.14 (default, Sep 22 2017, 00:05:22) [GCC 4.2.1 Compatible Apple LLVM 7.3.0 (clang-703.0.31)
阅读全文
摘要:numpy.trace是求shape的对角线上的元素的和,具体看 https://docs.scipy.org/doc/numpy-1.13.0/reference/generated/numpy.trace.html 或者搜索 numpy.trace, 二维的比较好理解,对于三维以上的对角线(三维
阅读全文
摘要:https://docs.scipy.org/doc/numpy-dev/reference/generated/numpy.all.html#numpy.all 运行示例,却发生错误 Traceback (most recent call last): File "<stdin>", line 1
阅读全文
摘要:zen 即禅之意可以在python的命名行交互模式下以下的语句就能看到:import thisThe Zen of Python, by Tim PetersBeautiful is better than ugly.Explicit is better than implicit.Simple i...
阅读全文
摘要:http://blog.csdn.net/liushuaikobe/article/details/8586224写得非常的好,也很详细。有密码:mysql -u root -p无密码:mysql -u root
阅读全文
摘要:python 2.xfrom Tkinter import *import tkMessageBoxapp = Tk()app.title("HelloWorld")app.geometry('250x100+200+100')def shutdown(): if tkMessageBox.askokcancel(title = 'Are you sure?', message = 'Do you really want to quit?'): app.destroy() app.protocol("WM_DELET
阅读全文
摘要:1.包的引入2.X下是from Tkinter import *而3.x是from tkinter import *否则,会报找不到tkinter的错误Traceback (most recent call last): File "read_data_from_gui.py", line 1, in from tkinter import *ImportError: No module named tkinter2.消息框 1 # 2.X version 2 from Tkinter import * 3 import tkMessageBox 4 5 def save_
阅读全文
摘要:参考书,写下如下的程序: 1 # coding=utf-8 2 # 以上是为了能在文中添加中文的注释 3 4 def save_transaction(price, credit_card, description): 5 file = open("transaction.txt", "a") 6 file.write("%s%07d%16s\n" % (credit_card, price, description)) 7 file.close() 8 9 items = ["DONUT","LATTE
阅读全文
摘要:1.TypeError: coercing to Unicode: need string or buffer, type foundTraceback (most recent call last): File "unzip.py", line 20, in <module> tar = tarfile.open(file) File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/tarfile.py", line 1658, in open
阅读全文
摘要:环境:Ubuntu 10.10 + Python 2.6.6NLTK: http://nltk.org/ 一个基于Python的自然语言处理的工具包1.运行 sudo easy_install pip 出错,需要将setuptools-0.6c11-py2.6.egg之类的文件,设置成可执行的文件才可以chmod u+x setuptools-0.6c11-py2.6.egg2.sudo pip install -U numpy这一步如果安装失败,如出现如下的错误:Cannot compile 'Python.h'会导致后面 import nltk 是出现如下错误:Cannot
阅读全文
摘要:最近一直用Eclipse来开发Android应用,还是用PyDev for Eclipse插件下载地址:http://pydev.org/download.html插件地址: http://pydev.org/updates
阅读全文