python-3.5

How to install Psycopg2 for Python 3.5

牧云@^-^@ 提交于 2019-12-18 17:27:39
问题 I am trying the following command on Windows 7 using powershell pip install psycopg2 And i am getting an error: error: Microsoft Visual C++ 14.0 is required (Unable to find vcvarsall.bat). Command "C:\Users\Piyush\AppData\Local\Programs\Python\Python35\python.exe -c "import setuptools, tokenize; file ='C:\Users\Piyush\AppData\Local\Temp\pip-build-qe38dwoj\psycopg2\setup.py';exec(compile(getattr(tokenize, 'open', open)( file ).read().replace('\r\n', '\n'), file , 'exec'))" install --record C:

How to install Psycopg2 for Python 3.5

两盒软妹~` 提交于 2019-12-18 17:27:31
问题 I am trying the following command on Windows 7 using powershell pip install psycopg2 And i am getting an error: error: Microsoft Visual C++ 14.0 is required (Unable to find vcvarsall.bat). Command "C:\Users\Piyush\AppData\Local\Programs\Python\Python35\python.exe -c "import setuptools, tokenize; file ='C:\Users\Piyush\AppData\Local\Temp\pip-build-qe38dwoj\psycopg2\setup.py';exec(compile(getattr(tokenize, 'open', open)( file ).read().replace('\r\n', '\n'), file , 'exec'))" install --record C:

Problems with Pyinstaller with tkinter app on python 3.5

ぃ、小莉子 提交于 2019-12-18 17:05:10
问题 Just getting started with Pyinstaller (and somewhat with Tk windowing) and having trouble getting my tkinter windows app (under python 3.5) running successfully. I may be doing something stupid but I've tried everything I know and I really need to get this running, so any help is greatly appreciated. Just a note, all of my code runs fine under normal python 3.5.1 & 3.5.3. Have latest version of PyInstaller installed (3.2.1) and it appears to be running OK. I switched over to the following

Failing to import itertools in Python 3.5.2

微笑、不失礼 提交于 2019-12-18 15:08:09
问题 I am new to Python. I am trying to import izip_longest from itertools. But I am not able to find the import "itertools" in the preferences in Python interpreter. I am using Python 3.5.2. It gives me the below error- from itertools import izip_longest ImportError: cannot import name 'izip_longest' Please let me know what is the right course of action. I have tried Python 2.7 too and ended up with same problem. Do I need to use lower version Python. 回答1: izip_longest was renamed to zip_longest

How make Drag and Drop interface? [duplicate]

匆匆过客 提交于 2019-12-18 13:52:08
问题 This question already has answers here : Drag and Drop widgets tkinter (2 answers) Closed 2 years ago . Currently, I am working with Python 3.5 GUI development using tkinter module. I want to be able to drag an image from one place to another within the application. Does tkinter support drag and drop within an application, and if so, how do you do it? The question Drag and Drop in Tkinter? is asking about dragging and dropping between applications, which is not what I'm asking here. from

How can I execute JavaScript code from Python?

懵懂的女人 提交于 2019-12-18 11:57:43
问题 Lets say that I have this code inside a JavaScript file: var x = 10; x = 10 - 5; console.log(x); function greet() { console.log("Hello World!"); } greet() How would I use Python to execute this code and "print" x and Hello World! ? Here is some pseudo code that further explains what I'm thinking: # 1. open the script script = open("/path/to/js/files.js", "r") # 2. get the script content script_content = script.read() # 3. close the script file script.close() # 4. execute the script content

Using abc.ABCMeta in a way it is compatible both with Python 2.7 and Python 3.5

笑着哭i 提交于 2019-12-18 10:13:32
问题 I'd like to create a class which has abc.ABCMeta as a metaclass and is compatible both with Python 2.7 and Python 3.5. Until now, I only succeeded doing this either on 2.7 or on 3.5 - but never on both versions simultaneously. Could someone give me a hand? Python 2.7: import abc class SomeAbstractClass(object): __metaclass__ = abc.ABCMeta @abc.abstractmethod def do_something(self): pass Python 3.5: import abc class SomeAbstractClass(metaclass=abc.ABCMeta): @abc.abstractmethod def do_something

No module named 'matplotlib.pyplot'; 'matplotlib' is not a package

谁说我不能喝 提交于 2019-12-18 09:26:44
问题 Have found a similar issue, however haven't found proper solution. Here's a code: import matplotlib.pyplot as plt plt.plot([1,2,3],[4,2,5]) plt.show() Run, got the message: ImportError: No module named 'matplotlib.pyplot'; 'matplotlib' is not a package I run Linux Mint 18 with preinstalled python-2.7 and python-3.5 (I use python3), before that I was installing modules with a simple sudo apt-get install method and that worked great. Before running this the code above, I've installed matplotlib

Is it possible to make python throw errors if the type of the argument passed to the annotated function doesn't match the one specified?

 ̄綄美尐妖づ 提交于 2019-12-18 05:43:23
问题 One of the new features in python3.5 is type hinting. For example the code below is valid now: def greeting(name: str) -> str: return 'Hello ' + name But, as I understand, it doesn't check anything by itself and also is interpreted absolutely the same way as this: def greeting(name): return 'Hello ' + name and was implemented mostly to help static analyzers (and to make code that is easier to understand). But is there (or is planned to be implemented in the future) any way (maybe by using

Installing pip locally without root privileges

你。 提交于 2019-12-18 05:25:08
问题 I am working on a compute server which runs a linux. The machine is used by several users so I don't have and won't get root privileges. I need to install Keras which you would normally do by using pip Now, pip is not installed and the root won't install it for me either unless I beg him for probably a month or so. I tried to locally install pip with the python installation scrip Python352/bin/python3.5 get-pip.py --user This unfortunately throws me an no permission error /etc . This is not