python-3.5

Pyinstaller: Import Error: DLL load failed: The specified module could not be found

霸气de小男生 提交于 2021-02-05 05:56:07
问题 I'm trying create an executable from my code that uses PyQt5. I'm using Python 3.5.3 -64 bits, developing in Windows 10, and used pip to install pyinstaller 3.2.1. I run pyinstaller as such: pyinstaller.exe --onefile --windowed main.py I get an Import Error: File "C:\Python35\Scripts\pyinstaller-script.py", line 11, in <module> load_entry_point('PyInstaller==3.2.1', 'console_scripts', 'pyinstaller')() File "C:\Python35\lib\site-packages\pkg_resources\__init__.py", line 565, in load_entry

Appending characters to each line in a txt file with python

二次信任 提交于 2021-02-04 19:50:30
问题 I wrote the following python code snippet to append a lower p character to each line of a txt file: f = open('helloworld.txt','r') for line in f: line+='p' print(f.read()) f.close() However, when I execute this python program, it returns nothing but an empty blank: zhiwei@zhiwei-Lenovo-Rescuer-15ISK:~/Documents/1001/ass5$ python3 helloworld.py Can anyone tell me what's wrong with my codes? 回答1: Currently, you are only reading each line and not writing to the file. reopen the file in write

How to install OpenAI Universe without getting error code 1 on Windows?

痴心易碎 提交于 2021-02-04 13:26:23
问题 When I try to install OpenAi Universe on my Windows machine via python pip I get following stacktrace: Traceback (most recent call last): File "<string>", line 1, in <module> File "C:\Users\Me\AppData\Local\Temp\pip-build-yjf_mrwx\fastzbarlight\setup.py", line 49, in <module> proc = subprocess.Popen(['ld', '-liconv'], stderr=subprocess.PIPE) File "E:\Python3.5.2\lib\subprocess.py", line 947, in __init__ restore_signals, start_new_session) File "E:\Python3.5.2\lib\subprocess.py", line 1224, in

How to install OpenAI Universe without getting error code 1 on Windows?

假如想象 提交于 2021-02-04 13:26:07
问题 When I try to install OpenAi Universe on my Windows machine via python pip I get following stacktrace: Traceback (most recent call last): File "<string>", line 1, in <module> File "C:\Users\Me\AppData\Local\Temp\pip-build-yjf_mrwx\fastzbarlight\setup.py", line 49, in <module> proc = subprocess.Popen(['ld', '-liconv'], stderr=subprocess.PIPE) File "E:\Python3.5.2\lib\subprocess.py", line 947, in __init__ restore_signals, start_new_session) File "E:\Python3.5.2\lib\subprocess.py", line 1224, in

From psycopg2 import sql not working

回眸只為那壹抹淺笑 提交于 2021-01-29 04:44:25
问题 Looking for some help with an issue I am having with psycopg2 and Python3. I am trying to use the sql library from psycopg2 that is available in version 2.7.1. When trying to use from psycopg2 import sql I get the error message unresolved reference 'sql' I am using Xubuntu Linux 16.04 LTS and when issuing the command pip show psycopg2 in the terminal I get: Name: psycopg2 Version: 2.7.1 Summary: psycopg2 - Python-PostgreSQL Database Adapter Home-page: http://initd.org/psycopg/ Author:

From psycopg2 import sql not working

馋奶兔 提交于 2021-01-29 04:40:49
问题 Looking for some help with an issue I am having with psycopg2 and Python3. I am trying to use the sql library from psycopg2 that is available in version 2.7.1. When trying to use from psycopg2 import sql I get the error message unresolved reference 'sql' I am using Xubuntu Linux 16.04 LTS and when issuing the command pip show psycopg2 in the terminal I get: Name: psycopg2 Version: 2.7.1 Summary: psycopg2 - Python-PostgreSQL Database Adapter Home-page: http://initd.org/psycopg/ Author:

Using Pandas and Sklearn.Neighbors

和自甴很熟 提交于 2021-01-29 02:48:14
问题 I'm trying to fit a KNN model on a dataframe, using Python 3.5/Pandas/Sklearn.neighbors. I've imported the data, split it into training and testing data and labels, but when I try to predict using it, I get the following error. I'm quite new to Pandas so any help would be appreciated, thanks! import pandas as pd from sklearn import cross_validation import numpy as np from sklearn.neighbors import KNeighborsRegressor seeds = pd.read_csv('seeds.tsv',sep='\t',names=['Area','Perimeter',

PyInstaller maximum recursion error after pre-safe import module hook [six.moves]

倾然丶 夕夏残阳落幕 提交于 2021-01-27 23:06:44
问题 I am trying to use PyInstaller to convert my python3.5 project into an .exe file My main file is SegTool.py This is my .spec file: # -*- mode: python -*- block_cipher = None a = Analysis(['SegTool.py'], pathex=['consts.py', 'FetalMRI_about.py', 'FetalMRI_mainwindow.py', 'FetalMRI_workspace.py', 'image_label.py', 'main_window.py', 'scan_file.py', 'segment3d_itk.py', 'Shapes.py', 'workspace.py', 'C:\\Users\\Keren Meron\\Documents\\School Work\\Fetal MRI\\FetalSegBrainTool'], binaries=[], datas=

How to calculate mean, mode, variance, standard deviation etc. of output in python?

末鹿安然 提交于 2021-01-27 21:50:43
问题 I have a simple game which is based on probabilities, every day we toss a coin and if we get heads then we win and we get $20 and if we toss the coin and we get tails then we lose $19, at the end of the month (28 days) we see how much we have lost or made. def coin_tossing_game(): random_numbers = [random.randint(0, 1) for x in range(500)] #generate 500 random numbers for x in random_numbers: if x == 0: #if we get heads return 20 #we win $20 elif x == 1: #if we get tails return -19 #we lose

Does “sys.settrace” work properly in Python 3.5 but not in Python 3.6?

落爺英雄遲暮 提交于 2021-01-27 21:01:20
问题 While trying to answer another question, it dawned on me that you can have code run any time in a thread when you theoretically should not have control. CPython has a settrace function for registering a tracing function in one's code. To test this idea from the use of a class, the following code was written. The problem is that tracing does not seem to occur, and no data is generated in the tracing log. What is causing the problem in the code shown below? #! /usr/bin/env python3 import atexit