I am searching to do a little programm with 3D animations for one homework for my school.
I work in Spyder space from Anaconda(Python) .
I want to import for that the module vpython installed by pip.
The first line of the function " from visual import * " doesn't work whereas in all examples found on the web, all the programms begins by this line for calling the whole function of this module. Also, i have seen different path and files "vpython" installes on my PC in the path Anaconda3.
So, for me, python don't arrive to find the good path with "import".
Have I to uninstall and install again Python and Anaconda or this is just a problem of grammary from me on my programm and i must help the function import to find the good path, writing some new instructions?
Thanks to have read and i wish you have one idea of what is wrong in this because for the moment I'm blocked.
In Jupyter/iPython/Anaconda, the import should be
from vpython import *
In classic VPython, it's
from visual import *
Related
vscode doesn't give any Code Action import suggestions for a specific python module I install in the python environment (it's a module I created). I can manually add the import - works. I get import suggestions for all other modules I installed . I can also follow up code into the module (after I have the import, go to definition works). It seems it's only missing as a source of import suggestions.
Is the module missing something?
I’m new to both micro:bit and MicroPython (or Python in general) - but I want to have it all running in VSCode. I grabbed this extension which was really smooth working with.
My problem now is that I want to leverage external modules, for things like the NeoPixels and also the bit:bot stuff, but I don’t know how to actually get that working. The NeoPixel tutorial is straight forward, but there is no mention on how to add the module.
I tried adding them with pip - but that won’t make them end up on the device. I’ve also tried this extension - hoping it would do some more magic in getting it onto the device.
Is this doable? Or would I have to revert do the online editors?
The micro:bit is a very constrained environment and will not run Python only MicroPYthon. MicroPython was designed to work under the constrained conditions of a microcontroller. As a result MicroPython does not come with the full Python standard library and only includes a small subset of the Python standard library.
For MicroPython to run on the micro:bit there needs to be the MicroPython hex file and any Python code that you have written, with main.py being the entry point.
The VS Code Extensions you linked to use uFlash to copy from your machine to the micro:bit the hex file and any Python files you have written.
To use the neopixel module it should be as straight forward as import neopixel as it is part of the standard BBC micro:bit MicroPython.
For BitBot, it only uses the standard micro:bit MicroPython library so I'm not sure what you are looking to import.
You can create a module by putting the code in .py file and referencing it in your main.py file. You do this by using an import statement that calls the file or specific parts of it.
MicroPython does have the concept of upip but I am not aware of that being available on micro:bit.
At the beginning of my IJulia notebook, I have the following preamble that imports several libraries and puts them on all processors:
addprocs(4)
import PyCall
#everywhere using PyCall
#everywhere #pyimport numpy as np
#everywhere #pyimport scipy as sc
.
.
.
The format is from the excepted answer to one of my previous questions. What I want to do now is add the processors and import all my packages in one line. However, I am not sure what would be the most efficient way to do this. I am collaborating with several people on different scientific projects, and I would prefer this importing process to be as simple as possible. Should I make a separate file calling these libraries and then run that file, or should I make my own package that does the above--i.e., define a package that automatically adds the processors, imports the packages, and puts them on all processors?
I am getting the following error while trying to run a sympy file in order to contribute to sympy. It is :
ImportError: No module named sympy
I installed the sympy module through pip for both python2.7 and python 3.
Also, isympy is working.
Strangly, when I try to import sympy in python's interactive console in the main sympy directory, no import errors are shown but in some other directory, it shows import errors.
Please help me to download the sympy module in a way that I will be able to run the code.
Thanks.
Importing module in python console of main directory.
Importing module in some other directory.
A likely cause here is that you are using two different Pythons. If you have Python installed multiple times (like Python 2 and Python 3), each has its own separate packages. You can check what Python you are using by printing sys.executable.
I should point out that for the purposes of contributing to SymPy, you generally want to run against the development version. That is, running Python from the SymPy directory and importing the development version from there, without actually installing it.
Thanks for the reply.
But I solved the problem. I realised that I didn't install sympy in the current conda environment. When I tried it using the command:
conda install sympy
It worked and no error is being shown.
Thanks.
I have a fairly new install of Anaconda with Python 3.3, and am using Pydev.
When I try to use tkinter with
from tkinter import Tk
master = Tk() # create a Tk root widget, which is a window
I get the following message
_tkinter.TclError: Can't find a usable init.tcl in the following directories:
C:/Anaconda/envs/p33/lib/tcl8.5 C:/Anaconda/envs/lib/tcl8.5 C:/Anaconda/lib/tcl8.5 C:/Anaconda/envs/library C:/Anaconda/library C:/Anaconda/tcl8.5.11/library C:/tcl8.5.11/library
This page (http://mail.python.org/pipermail/python-list/2011-March/599573.html) suggests that I need to change the TCL_LIBRARY environment variable. But I do not know how to do that.
How can I make tkinter work with my build?
This isn't a proper solution, but I got it to work by copying the folders
C:\Anaconda\envs\p33\tcl\tcl8.5
C:\Anaconda\envs\p33\tcl
to
C:\Anaconda\envs\p33\Lib