python-3.2

How to install matplotlib with Python3.2

隐身守侯 提交于 2019-11-27 06:53:15
I installed python3.2 in ubuntu (the default edition is not deleted), and I follow the steps in here However when i use python3.2 setup.py install I got: "error: command 'gcc' failed with exit status 1", "src/ft2font.cpp:2224:29: error: ‘Int’ is not a member of ‘Py’" And when I use sudo apt-get install python-matplotlib I can use matplot in python2.x, while I still can not use it with python3.2 How can I install matplot in python3.2 ? Matplotlib supports python 3.x as of version 1.2, released in January, 2013. To install it, have a look at the installation instructions . In general, call pip

Sending mail error with python smtplib

你说的曾经没有我的故事 提交于 2019-11-27 02:03:00
I am attempting to use the python 3.2 SMTPlib.sendmail() function to send a message, after some modifcation of the SMTP library (namely commenting out the rset() function which was suppressing the error msg) I managed to retrieve the following error message from the server: SendMail Failed (554, b'Transaction failed : Cannot send message due to possible abuse; please visit http://postmaster.yahoo.com/abuse_smtp.html for more information') The yahoo mail SMTP server thinks I'm sending spam, the URL does link to anything useful. I think it has to do with an inadequate header, I can't seem to

How to know/change current directory in Python shell?

Deadly 提交于 2019-11-26 23:30:52
I am using Python 3.2 on Windows 7. When I open the Python shell, how can I know what the current directory is and how can I change it to another directory where my modules are? You can use the os module. >>> import os >>> os.getcwd() '/home/user' >>> os.chdir("/tmp/") >>> os.getcwd() '/tmp' But if it's about finding other modules: You can set an environment variable called PYTHONPATH , under Linux would be like export PYTHONPATH=/path/to/my/library:$PYTHONPATH Then, the interpreter searches also at this place for import ed modules. I guess the name would be the same under Windows, but don't

PyEval_InitThreads in Python 3: How/when to call it? (the saga continues ad nauseam)

无人久伴 提交于 2019-11-26 20:04:25
Basically there seems to be massive confusion/ambiguity over when exactly PyEval_InitThreads() is supposed to be called, and what accompanying API calls are needed. The official Python documentation is unfortunately very ambiguous. There are already many questions on stackoverflow regarding this topic, and indeed, I've personally already asked a question almost identical to this one, so I won't be particularly surprised if this is closed as a duplicate; but consider that there seems to be no definitive answer to this question. (Sadly, I don't have Guido Van Rossum on speed-dial.) Firstly, let

UnicodeEncodeError: 'ascii' codec can't encode character in position 0: ordinal not in range(128)

徘徊边缘 提交于 2019-11-26 19:19:58
问题 I'm working on a Python script that uses the scissor character (9986 - ✂) and I'm trying to port my code to Mac, but I'm running into this error. The scissor character shows up fine when run from IDLE (Python 3.2.5 - OS X 10.4.11 iBook G4 PPC) and the code works entirely fine on Ubuntu 13.10, but when I attempt to run this in the terminal I get this error/traceback: Traceback (most recent call last): File "snippets-convert.py", line 352, in <module> main() File "snippets-convert.py", line 41,

How to install matplotlib with Python3.2

会有一股神秘感。 提交于 2019-11-26 12:58:15
问题 I installed python3.2 in ubuntu (the default edition is not deleted), and I follow the steps in here However when i use python3.2 setup.py install I got: \"error: command \'gcc\' failed with exit status 1\", \"src/ft2font.cpp:2224:29: error: ‘Int’ is not a member of ‘Py’\" And when I use sudo apt-get install python-matplotlib I can use matplot in python2.x, while I still can not use it with python3.2 How can I install matplot in python3.2 ? 回答1: Matplotlib supports python 3.x as of version 1

NameError: name &#39;reduce&#39; is not defined in Python

痞子三分冷 提交于 2019-11-26 11:56:16
问题 I\'m using Python 3.2. Tried this: xor = lambda x,y: (x+y)%2 l = reduce(xor, [1,2,3,4]) And got the following error: l = reduce(xor, [1,2,3,4]) NameError: name \'reduce\' is not defined Tried printing reduce into interactive console - got this error: NameError: name \'reduce\' is not defined Is reduce really removed in Python 3.2? If that\'s the case, what\'s the alternative? 回答1: It was moved to functools. 回答2: You can add from functools import reduce before you use the reduce. 回答3: Or if

PyEval_InitThreads in Python 3: How/when to call it? (the saga continues ad nauseam)

Deadly 提交于 2019-11-26 06:32:46
问题 Basically there seems to be massive confusion/ambiguity over when exactly PyEval_InitThreads() is supposed to be called, and what accompanying API calls are needed. The official Python documentation is unfortunately very ambiguous. There are already many questions on stackoverflow regarding this topic, and indeed, I\'ve personally already asked a question almost identical to this one, so I won\'t be particularly surprised if this is closed as a duplicate; but consider that there seems to be

Remove and Replace Printed items [duplicate]

和自甴很熟 提交于 2019-11-26 03:37:14
问题 This question already has an answer here: Print in one line dynamically 17 answers I was wondering if it was possible to remove items you have printed in Python - not from the Python GUI, but from the command prompt. e.g. a = 0 for x in range (0,3): a = a + 1 b = (\"Loading\" + \".\" * a) print (a) so it prints >>>Loading >>>Loading. >>>Loading.. >>>Loading... But, my problem is I want this all on one line, and for it it remove it self when something else comes along. So instead of printing \