spyder

Load environment variables of bashrc into python

自闭症网瘾萝莉.ら 提交于 2020-01-05 10:28:19
问题 I'm trying to set the environment variable of my .bashrc using Spyder; in other words I'm looking for a python command that reads my .bashrc . Any idea? 回答1: .bashrc should automatically be loaded into the environ on login import os print os.environ if you wanted to create a dictionary of values from a bash source file you could in theory do something like output = subprocess.check_output("source /path/to/.bashrc;env") env = dict(line.split("=") for line in output.splitlines() if "=" in line)

How to execute with optional argument in Spyder? [duplicate]

半城伤御伤魂 提交于 2020-01-05 07:12:31
问题 This question already has answers here : How to use argv with Spyder (4 answers) Closed last year . I don't know how to execute a program with optional arguments on Spyder. I know how to pass variables to it, but my program uses argparse, and I want to execute it with the "-h" or "--help" option, the code is the following one import argparse parser = argparse.ArgumentParser() parser.parse_args() For now, it only has the default optional argument of "-h"/"--help", I tried putting it on

How to execute with optional argument in Spyder? [duplicate]

偶尔善良 提交于 2020-01-05 07:12:10
问题 This question already has answers here : How to use argv with Spyder (4 answers) Closed last year . I don't know how to execute a program with optional arguments on Spyder. I know how to pass variables to it, but my program uses argparse, and I want to execute it with the "-h" or "--help" option, the code is the following one import argparse parser = argparse.ArgumentParser() parser.parse_args() For now, it only has the default optional argument of "-h"/"--help", I tried putting it on

Installing Python modules with Anaconda or Canopy

家住魔仙堡 提交于 2020-01-04 14:06:33
问题 I have played around with Python a little but never have I had to install my own packages. I am currently trying to write a program that reads in 'tiff' files so I'm trying to install the 'libtiff' package and I'm having a nightmare! First, I was using the Anaconda distribution and the phrase 'conda install libtiff' which would tell me the install was successful. However then I was never able to find libtiff in the Spyder IDE or ipython console. Having used Canopy in the past, I uninstalled

Anaconda libstdc++.so.6: version `GLIBCXX_3.4.20' not found

不羁的心 提交于 2020-01-03 18:53:10
问题 I am using anaconda for python and I face this problem I tried a lot to solve this error, but still not solved. I used the following commands so far sudo apt-get install libstdc++6 sudo add-apt-repository ppa:ubuntu-toolchain-r/test sudo apt-get update sudo apt-get upgrade sudo apt-get dist-upgrade conda install libgcc in this link a solution provided but I still don't know how to do that 回答1: I solved this by conda install libgcc=5.2.0 回答2: I meet the same problem, which is when I run

Running scripts in Spyder using windows Command Prompt or PowerShell

旧城冷巷雨未停 提交于 2020-01-03 17:26:21
问题 I would like to know if there is a way to run python scripts in spyder-ide using windows cmd or PowerShell instead of IPython console. Ipython sometimes works differently than if the script is run in cmd specially for plotting packages like matplotlib, etc. I am using Spyder latest version. Regards 回答1: In Spyder, you can click Run > Configuration per file, which will give you plenty of options in where your Spyder-IDE-Script is launched. 回答2: I think the option you are looking for is

Matplotlib Freezes When input() used in Spyder

对着背影说爱祢 提交于 2020-01-03 16:46:10
问题 Windows 7. If I open a plain ipython terminal at the command line I can type: import matplotlib.pyplot as plt plt.plot([1, 2, 3, 4, 5]) plt.show(block=False) input("Hello ") But if I do the same thing in Spyder, as soon as I ask for user input, the Matplotlib window freezes, so I can't interact with it. I need to interact with the plot while the prompt is showing. In both Spyder and the plain console, matplotlib.get_backend() return 'Qt4Agg' Edit: To clarify, I have matplotlib set up where it

How to exit a script in Spyder?

霸气de小男生 提交于 2020-01-03 12:02:25
问题 I am using WinPython's Spyder. When I am creating a new script with the command exit() , and run it there, this command kills the kernel: It seems the kernel died unexpectedly. Use 'Restart kernel' to continue using this console. What's the right way to stop a script in this runtime environment? 回答1: One can exit the script by raising a custom exception like raise Exception('exit') or encapsulate the code into a main function and use return inside. If one doesn't want to change the script,

How to exit a script in Spyder?

梦想与她 提交于 2020-01-03 12:01:46
问题 I am using WinPython's Spyder. When I am creating a new script with the command exit() , and run it there, this command kills the kernel: It seems the kernel died unexpectedly. Use 'Restart kernel' to continue using this console. What's the right way to stop a script in this runtime environment? 回答1: One can exit the script by raising a custom exception like raise Exception('exit') or encapsulate the code into a main function and use return inside. If one doesn't want to change the script,

How to view class objects in Spyder's variable explorer

拈花ヽ惹草 提交于 2020-01-02 06:19:29
问题 This is a repeat of this question. It seems that I can't view instances of my classes in the variable explorer in Python, when I'm debugging. There the answer claims that this is resolved, so I'm wondering what I'm doing wrong. 回答1: ( Spyder maintainer here ) By default we show builtins (ints, floats, strings, list, dicts and tuples), Numpy arrays and Dataframes in our Variable Explorer. If you want to see all objects present in your namespace, you need to go to the menu Tools > Preferences >