python-3.6

Python pip3 egg_info error code 1 while installing Pygame

妖精的绣舞 提交于 2019-12-11 04:33:19
问题 I have recently got python 3.6 and I am installing python packages. So far requests has worked but for pygame, I get an error: WARNING, No "Setup" File Exists, Running "config.py" Using WINDOWS configuration... Path for SDL not found. Too bad that is a requirement! Hand-fix the "Setup" Path for FONT not found. Path for IMAGE not found. Path for MIXER not found. Path for PNG not found. Path for JPEG not found. Path for PORTMIDI not found. Path for COPYLIB_tiff not found. Path for COPYLIB_z not

ssl.SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:747) on OS X

社会主义新天地 提交于 2019-12-11 04:17:46
问题 I am trying this bit of code. import pandas as pd fiddy_states=pd.read_html('https://simple.wikipedia.org/wiki/List_of_U.S._states') print(fiddy_states[0]) I am getting following error: Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/urllib/request.py", line 1318, in do_open encode_chunked=req.has_header('Transfer-encoding')) File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py", line 1239, in request

How to fix 'Missing required dependencies ['numpy']' when running packaged app made with PyInstaller?

会有一股神秘感。 提交于 2019-12-11 04:14:06
问题 When I run my packaged app I get the error ImportError: Missing required dependencies ['numpy'] . How do I fix this? The full error: I used pyinstaller guiMain.py to create the .exe, within a virtual environment created with pipenv shell . This virtual environment has numpy 1.16.0 installed, aswell as pandas , pyinstaller , sklearn , googleads and pytest . When I run the code (unpackaged and within the virtual environment) everything works fine. The packaging process goes fine aswell, until I

Issue installing Tensorflow — not a CUDA/CuDNN issue

蹲街弑〆低调 提交于 2019-12-11 04:07:02
问题 I recently started getting into Tensorflow, but i'm having issues with the install. Everytime I try to import it I get the following error >>> import tensorflow as tf Traceback (most recent call last): File "C:\Users\[user]\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 14, in swig_import_helper return importlib.import_module(mname) File "C:\Users\[user]\AppData\Local\Programs\Python\Python36\lib\importlib\__init__.py", line 126

Pandas 0.22.0: IndexError: list index out of range when reading xls

て烟熏妆下的殇ゞ 提交于 2019-12-11 01:47:08
问题 I'm trying to load a 282Mb (65536 rows x 138 columns) .xls file into a pandas dataframe import pandas as pd import os filename = r'invoicing.xls' dir = os.path.dirname(os.path.abspath(filename)) excelFile = os.path.join(dir, filename) invoicing_info = pd.read_excel(excelFile) But I'm getting this Traceback (most recent call last): File "/Users/juanda/conda_envs/Hyperion_contracts_env/lib/python3.6/site-packages/xlrd/sheet.py", line 698, in put_cell_unragged self._cell_types[rowx][colx] =

Is there any way to override Python's built-in class?

限于喜欢 提交于 2019-12-11 01:46:07
问题 I am trying to change the behavior of python's int class, but I'm not sure if it can be done using pure python. Here is what I tried so far: import builtins class int_new(builtins.int): def __eq__(self, other): return True int = int_new print(5 == 6) # the result is False, but I'm anticipating True 回答1: You should replace last line with: print(int(5) == int(6)) to force/ask Python to use your new class for integer numbers. 回答2: A year later I finally learned what I was wondering. When I was

Exit multiprocesses gracefully in python3

眉间皱痕 提交于 2019-12-11 00:47:59
问题 I would like to exit the program gracefully on Ctrl+C / SIGINT or on user input. If possible the terminal should prompt something like; "Hit enter to terminate". Code to be executed by Python 3.6 def worker(process): i = 0 while True: print('Process %d count %d' % (process, i)) i += 1 def main(): available_num_cores = multiprocessing.cpu_count() use_num_cores = available_num_cores - 1 if available_num_cores > 1 else 1 print('Using %d cores' % use_num_cores) pool = multiprocessing.Pool(use_num

How { } quantifier works?

半世苍凉 提交于 2019-12-10 23:15:33
问题 >>> >>> re.search(r'^\d{3, 5}$', '90210') # {3, 5} 3 or 4 or 5 times >>> re.search(r'^\d{3, 5}$', '902101') # {3, 5} 3 or 4 or 5 times >>> re.search(r'^\w{3, 5}$', 'hello') # {3, 5} 3 or 4 or 5 times >>> re.search(r'^\w{3, 5}$', 'hell') # {3, 5} 3 or 4 or 5 times >>> All of the above suppose to should work, with {} quantifier Question: Why r'^\d{3, 5}$' does not search for '90210' ? 回答1: There should be no space between {m and , and n} quantifier: >>> re.search(r'^\d{3, 5}$', '90210') # with

What's wrong with passing a dict to OrderedDict?

你离开我真会死。 提交于 2019-12-10 18:23:41
问题 I'm reading @Martijn Pieters' response to Converting dict to OrderedDict. The main point of his answer is that passing a regular dict to OrderedDict() will not retain the order as desired, because the dict that you are passing has already "lost" any semblance of order. His solution is to pass tuples that make up the dict's key/value pairs instead. However, I also noticed the following in the docs: Changed in version 3.6: With the acceptance of PEP 468, order is retained for keyword arguments

Cartopy examples produce a Segmentation fault

末鹿安然 提交于 2019-12-10 18:22:13
问题 Cartopy can't draw virtually anything. Even a simple example results in a segfault. Segmentation fault is all Python 3.7.0 says before crashing. So does Python 3.6.6 . The faulty line appear to be ax.coastlines() . ax.gridlines() gives the same silent segfault as well. matplotlib is 2.2.3 . Cartopy is the most recent by the date, 0.16.0 , installed with pip . All the requirements ( six , pyshp , setuptools , shapely , numpy ) are met. Reinstalling with pip doesn't help. Installing the same