python-3.4

pip3 GDAL install failed on Command “python setup.py egg_info” failed with error code 1

♀尐吖头ヾ 提交于 2019-12-18 09:48:39
问题 I have a requirements.txt with python3 package that is used to deploy a webapp that uses GDAL. When I try to install the requirements.txt using pip3 install -r requirements.txt , it fails on per the below error. I'm on Centos 7. I've tried (all in sudo su -) pip3 install --global-option=build_ext --global-option="-I/usr/include/gdal" GDAL==2.2.4 pip3 install --upgrade setuptools pip3 download GDAL yum install gdal-devel gcc pip3 install GDAL ERROR: Collecting GDAL Using cached https://files

Python resolution of datetime.now()

☆樱花仙子☆ 提交于 2019-12-18 08:56:41
问题 from datetime import datetime import time for i in range(1000): curr_time = datetime.now() print(curr_time) time.sleep(0.0001) I was testing the resolution of datetime.now() . Since it supposes to output in microsecond, I expected that each print will be different. However, I always get something like that. ... 2015-07-10 22:38:47.212073 2015-07-10 22:38:47.212073 2015-07-10 22:38:47.212073 2015-07-10 22:38:47.212073 2015-07-10 22:38:47.212073 2015-07-10 22:38:47.212073 2015-07-10 22:38:47

How to write a numpy array to a csv file?

雨燕双飞 提交于 2019-12-18 06:55:11
问题 I want to open up a new text file and then save the numpy array to the file. I wrote this bit of code: foo = np.array([1,2,3]) abc = open('file'+'_2', 'w') np.savetxt(abc, foo, delimiter=",") I get this error: TypeError Traceback (most recent call last) <ipython-input-33-fea41927952b> in <module>() 2 model = cool 3 abc = open('file'+'_2', 'w') ----> 4 np.savetxt(abc, foo, delimiter=",") /usr/local/lib/python3.4/site-packages/numpy/lib/npyio.py in savetxt(fname, X, fmt, delimiter, newline,

How to stream stdout/stderr from a child process using asyncio, and obtain its exit code after?

て烟熏妆下的殇ゞ 提交于 2019-12-18 06:48:17
问题 Under Python 3.4 on Windows, I need to stream data written to stdout/stderr by a child process, i.e. receive its output as it occurs, using the asyncio framework introduced in Python 3.4. I also have to determine the program's exit code afterwards. How can I do this? 回答1: The solution I've come up with so far uses SubprocessProtocol to receive output from the child process, and the associated transport to get the process' exit code. I don't know if this is optimal though. I've based my

ImportError: No module named matplotlib with matplotlib installed

牧云@^-^@ 提交于 2019-12-18 05:43:29
问题 The code line: import matplotlib The error: ImportError: No module named 'matplotlib' The problem: which python3.4 % /usr/bin/python3.4 Where is matplotlib installed? sudo find /usr | grep matplotlib % /usr/lib/pymodules/python2.7/matplotlib/... Some considerations: OS: Linux Mint 17.2 I need to use Python 3.4 Solutions: import sys sys.path.append('/usr/lib/pymodules/python2.7/') (Not happy with this one). Using pip3 install matplotlib or sudo pip3 install matplotlib (Recieving errors, and i

python import multiple times

 ̄綄美尐妖づ 提交于 2019-12-18 04:10:50
问题 I suppose this is a general question so sorry if not posted in the right place. Say for instance, I have a function a which imports os . If I was to call this function from another file multiple times I am assuming that the import would be done multiple times as well? Is there a way to only import the module if its not already present? Basically, I have a class which calls multiple functions imported from various files, instead of importing the whole file I thought it would be easier to

Python 3.4 and 2.7: Cannot install numpy package for python 3.4

筅森魡賤 提交于 2019-12-17 22:56:57
问题 I am using Ubuntu 12.04 and want to use python 3.4 side by side with python 2.7. The installation of python 3.4 worked properly. However, I cannot install the numpy package for python 3 (and as a consequence I can't install scipy, pandas etc.). Using sudo pip3 install numpy spits out the following error: File "numpy/core/setup.py", line 289, in check_types "Cannot compile 'Python.h'. Perhaps you need to "\ SystemError: Cannot compile 'Python.h'. Perhaps you need to install python-dev|python

from . import _methods ImportError: cannot import name '_methods' in cx-freeze python

試著忘記壹切 提交于 2019-12-17 19:38:19
问题 exe build successfully by using cx-freeze. But it shows the following error when I execute the exe file: from . import _methods ImportError: cannot import name '_methods' 回答1: This question was already answer here: Why am I getting this ImportError? but for the sake of completeness here is the answer for this specific case: cx_freeze is not importing the optional module _method , so you have to tell him explicitly to do it. additional_mods = ['numpy.core._methods', 'numpy.lib.format'] setup

Windows 10 and Unable to find vcvarsall.bat

我只是一个虾纸丫 提交于 2019-12-17 17:59:25
问题 When I try to build one package: C:\Linter\intlib\PYTHON>python setup.py build I get this error message: running build running build_ext building 'LinPy' extension error: Unable to find vcvarsall.bat This is my Python version: Python 3.4.4 (v3.4.4:737efcadf5a6, Dec 20 2015, 20:20:57) [MSC v.1600 64 bit (AMD64)] on win32 And I'm working on Windows 10 x64. I know about this thread and dozens of others (like this and this and the list goes on). So, I guess I tried almost everything, but nothing

urllib HTTPS request: <urlopen error unknown url type: https>

别等时光非礼了梦想. 提交于 2019-12-17 12:34:14
问题 I have a script on python3.4 and it has been fine until the website I download the file from decides to use https and now I am getting error but can't figure out how I can retrive the file. My script import the following library and uses the urlretrive to get the file previously. Since it is now forwarded to https with 302 redirection. I am getting some error. import urllib import urllib.request urllib.request.urlretrieve("http://wordpress.org/latest.tar.gz", "/thefile.gz") My error:-