python-3.3

Numpy-MKL for OS X

时光总嘲笑我的痴心妄想 提交于 2020-01-12 19:04:51
问题 I love being able to use Christoph Gohlke's numpy-MKL version of NumPy linked to Intel's Math Kernel Library on Windows. However, I have been unable to find a similar version for OS X, preferably NumPy 1.7 linked for Python 3.3 on Mountain Lion. Does anyone know where this might be obtained? EDIT: So after a bit of hunting I found this link to evaluate Intel's Composer XE2013 studios for C++ and Fortran (both of which contain the MKL), as well as a tutorial on building NumPy and SciPy with it

Passing the library path as a command line argument to setup.py

拟墨画扇 提交于 2020-01-12 14:27:28
问题 modules = [Extension("MyLibrary", src, language = "c++", extra_compile_args=["-fopenmp", "-std=c++11", "-DNOLOG4CXX"], # log4cxx is not currently used extra_link_args=["-fopenmp", "-std=c++11"], include_dirs=[os.path.join(os.path.expanduser("~"), (os.path.join(gtest, "include"))], library_dirs=[log4cxx_library, os.path.join(os.path.expanduser("~"), gtest)], libraries=["log4cxx", "gtest"])] This is a part of my setup.py script. How do I pass options like include_dirs or library_dirs through

1)Why is there an “invalid syntax” (line highlighted in code)? 2) After the error is solved, why is only the if statement read by python?

我只是一个虾纸丫 提交于 2020-01-06 08:07:06
问题 I'm writing a 2 player dice game where two 6-sided dice are randomly rolled. If the sum of the dice are even, + 10 to the total of the two dice thrown. If the sum of the dice are odd, -5 from the total of the dice thrown. If the user rolls doubles, they roll another die and their score is the sum of all 3 die. There are 5 rounds and the code shown is Player 1's 1st round. 1) Why is there suddenly an "invalid syntax" (2nd last line, highlighted in code)? 2) Why is only the if statement read?

python django - page not found error (404)- static error

这一生的挚爱 提交于 2020-01-06 03:11:47
问题 I somehow got the application running on django (new to python and django) and although the page loads the default URL (127.0.0.1:8000) but it does load the css files. It produces following error css files are directly accessed. Page not found (404) Request Method: GET Request URL: http://127.0.0.1:8000/static/css/bootstrap.min.css 'css\bootstrap.min.css' could not be found You're seeing this error because you have DEBUG = True in your Django settings file. Change that to False, and Django

I have installed a python library but dreampie won't import it

戏子无情 提交于 2020-01-03 16:54:25
问题 I have installed a python library in python3.3. When I run the interpreter in Dreampie, it can't find my newly-installed library, resulting in an error like: >>> from bs4 import BeautifulSoup Traceback (most recent call last): File "<pyshell#4>", line 1, in <module> from bs4 import BeautifulSoup ImportError: No module named 'bs4' 回答1: This is a dreampie 1.2.1 bug. To work around it, under Edit | Preferences | Shell, add the following line to the automatically-run code in the black box: import

How to pass a sqlite Connection Object through multiprocessing

久未见 提交于 2020-01-03 13:05:32
问题 I'm testing out how multiprocessing works and would like an explanation why I'm getting this exception and if it is even possible to pass the sqlite3 Connection Object this way: import sqlite3 from multiprocessing import Queue, Process def sql_query_worker(conn, query_queue): # Creating the Connection Object here works... #conn = sqlite3.connect('test.db') while True: query = query_queue.get() if query == 'DO_WORK_QUIT': break c = conn.cursor() print('executing query: ', query) c.execute

How to convert days into months using datetime in Python3?

杀马特。学长 韩版系。学妹 提交于 2020-01-03 01:46:32
问题 Is there a special method to derive this or do we have to create loops? The parameters for this function is actually (year, num_of_days). But I have no idea how to derive months from this. This is what I have so far (incomplete) but it doesn't take into the different month days into account. Is there an easier way to tackle this question? Thanks in advance! def daynum_to_date(year : int, daynum : int) -> datetime.date: '''Return the date corresponding to the year and the day number, daynum,

print two dimensional list

南笙酒味 提交于 2020-01-01 08:43:20
问题 I have a list, in which is another list and I want to doc.write(a) a = [[1, 2, "hello"], [3, 5, "hi There"], [5,7,"I don't know"]] doc.write(''.join(a)) TypeError: sequence item 0: expected str instance, list found How can I handle this, do I have to make a for-loop in which I join and add all the sublists? The real goal was to make it somehow readable for human beeing, but I didn't wanted a finished solution from you. 回答1: You can try something like >>> a = [[1, 2, "hello"],[3, 5, "hi There"

Connecting signal to slot immediately causes signal to be emitted

不羁的心 提交于 2019-12-31 04:04:18
问题 I am writing a program with python 3.3.3 and pyqt5. I have connected many signals and slots with no problem. This one is causing a problem. My code follows: def populateVendorAndModelComboBoxes(self, vendorComboBox, modelComboBox): dictVendors = {} #for rclass in sorted(list(directory.DRV_TO_RADIO.values())): for rclass in list(directory.DRV_TO_RADIO.values()): if not issubclass(rclass, chirp_common.CloneModeRadio) and \ not issubclass(rclass, chirp_common.LiveRadio): continue if not rclass

How to run a function after a given amount of time in tkinter?

回眸只為那壹抹淺笑 提交于 2019-12-31 03:25:09
问题 So I have a .gif picture on a canvas in tkinter. I want this picture to change to another picture...but only for 3 seconds. and for it revert back to the original picture. def startTurn(self): newgif = PhotoImage(file = '2h.gif') self.__leftImageCanvas.itemconfigure(self.__leftImage, image = newgif) self.__leftImageCanvas.image = newgif while self.cardTimer > 0: time.sleep(1) self.cardTimer -=1 oldgif = PhotoImage(file = 'b.gif') self.__leftImageCanvas.itemconfigure(self.__leftImage, image =