spyder

virtualenv IPython in Spyder not working

梦想与她 提交于 2019-11-30 03:17:09
问题 I have installed Spyder on Linux (Mint 17 to be exact) and created a scientific virtualenv (sci) with ipython, numpy, etc. The idea is to vary my virtual env for python 2 / python 3 and being a bit more flexible than installing the whole of Anaconda / python(x,y). I am having problems getting ipython to work in Spyder now. I went to Tools->Preferences->Console->Advanced settings Use the following Python interpreter /home/mike/envs/sci/bin/ipython but this did not start ipython. It responds

ImportError: No module named enum

不打扰是莪最后的温柔 提交于 2019-11-30 01:45:43
I changed from Win XP 32bit to Win7 64bit and reinstalled Python 2.7 and the Anaconda package. However, it seems like it isn't properly installed. When I do import enum There is the error: ImportError: No module named enum However, when I try import pandas it works. When typing help() and modules within Ipython nothing happens. Any idea how to go from here? Or run a pip install --upgrade pip enum34 I ran into this same issue trying to install the dbf package in Python 2.7. The problem is that the enum package wasn't added to Python until version 3.4. It has been backported to versions 3.3, 3.2

%matplotlib line magic causes SyntaxError in Python script

早过忘川 提交于 2019-11-29 20:09:27
I try to run the following codes on Spyder (Python 2.7.11): # -*- coding: utf-8 -*- import numpy as np import pandas as pd %matplotlib inline import matplotlib.pyplot as plt import matplotlib.cm as cm import tensorflow as tf # settings LEARNING_RATE = 1e-4 # set to 20000 on local environment to get 0.99 accuracy TRAINING_ITERATIONS = 2000 DROPOUT = 0.5 BATCH_SIZE = 50 # set to 0 to train on all available data VALIDATION_SIZE = 2000 # image number to output IMAGE_TO_DISPLAY = 10 But I got this error: line 10 %matplotlib inline ^ SyntaxError: invalid syntax. I appreciate if anybody gives me an

How do I debug efficiently with spyder in Python?

泄露秘密 提交于 2019-11-29 19:31:38
I like Python and I like Spyder but I find debugging with Spyder terrible! Every time I put a break point, I need to press two buttons: first the debug and then the continue button (it pauses at first line automatically) which is annoying. Moreover, rather than having the standard iPython console with auto completion etc I have a lousy ipdb>> console which is just garbage. The worst thing is that this console freezes very frequently even if I write prints or simple evaluation to try to figure out what is the bug. This is much worse than matlab. Last but not least, if I call a function from

Mayavi doesn't run from within Spyder: complains about “ValueError: API 'QString' …”

我们两清 提交于 2019-11-29 18:31:15
问题 I am unable to run/use Mayavi library from within Spyder IDE. I have described the problem below. Any help will be very useful. (Thank you very much in advance.) Steps to reproduce the problem: Just importing the Mayavi library in a script (for example using "import mayavi.mlab as mlab") and executing the script will reproduce this problem. I am including a test code (note that this code is an example code from the Mayavi website) here to reproduce the problem: code from numpy import sin, cos

Changing indentation settings in the Spyder editor for Python

泄露秘密 提交于 2019-11-29 17:47:51
问题 I am using the Spyder editor for Python. I need to change the indentation setting (e.g., let "tab" mean "4 spaces"). How do I accomplish this? 回答1: Tools >>> Preferences >>> Editor >>> Advanced settings >>> Indentation characters 回答2: go to >>>Tools in the menu bar Preferences >>> Editor >>> Advanced settings >>> Indentation characters set indentation characters: to "4 spaces" hurray! Mission accomplished 来源: https://stackoverflow.com/questions/36187784/changing-indentation-settings-in-the

How to get Spyder to open python scripts (.py files) directly from Windows Explorer

断了今生、忘了曾经 提交于 2019-11-29 17:37:14
问题 I have recently installed the Anaconda distribution on Windows 7 (Anaconda 3-2.4.0-Windows-x86_64). Unlike IDLE, I can't right-click and open a py file in the Spyder IDE. I will have to open Spyder first and then navigate to the file or drag and drop it in the editor. Is there any way to open the file in the editor directly from Widows Explorer? 回答1: With the current version of Anaconda (4.1.0) you can simply right-click on a python script in Windows File Explorer and choose "Open with". The

Logging input and output in Spyder's console

早过忘川 提交于 2019-11-29 16:40:47
I learnt data manipulation and analysis through Stata and I used the log command to record all the commands written and the output generated. Doing so I could reproduce my findings, check previous results and share it with others in pdf or txt. What to use with Python? Is there a difference if I use a Python Jupyter Notebook or Spyder? The way to do what you want is by using the %logstart command, as described here: Log IPython output? Stop using the python interpreter and start storing your commands in a text file before running them. This way you will be able to share, reuse, and revise your

How can I prevent Python from inserting a new line after taking user input?

六月ゝ 毕业季﹏ 提交于 2019-11-29 15:30:57
Python inserts a blank line in the console output between every call of the input() function but I don't want that (i.e. I want the input() prompts to be on contiguous lines in the console instead of separated by a blank line). Is there a way to do that? I tried using input("foo", end="") thinking it may work like the print() function but that's not the case... Code: fname = input("Please enter your first name: ") lname = input("Please enter your last name: ") print("Pleased to meet you, " + str(fname) + " " + str(lname) + "!") Output: Please enter your first name: Jane Please enter your last

update module on import to python interpreter

北慕城南 提交于 2019-11-29 15:12:48
In short How to force python interpreter to load the most up-to-date code version of my module everytime I make some changes in the module code? Or at least reload the last modified version by typing >>> from myModule import * into console, without necessity to restart whole python console and setup everything again and again anytime I make some changes? This is extremely unpleasant behavior for debugging. --------- LONGER STORY ----------- I tried to delete the .pyc file , and import it again - but it has no effect. It does't even create .pyc file again - so I expect it completely ignore my