How to run VPython on Mac offline - python

I don't have much experience with Python. Don't judge me for that. I just beg you to tell me how to take use of VPython. I already have Python installed on Mac. Version 3.9.8. At least I believe to know. It's something called IDLE Shell. Apparently I can run normal Python code there. But I didn't found any source telling me how to access on packages like VPython. Is it possible at all in the shell? Tutorials where that package is used I only see on online editors like Trinket or GlowScript itself. Normally access is granted by typing
GlowScript 2.6 VPython and afterwards the specific code follows. However in the shell it gives error invalid syntax. So does another trick exists?
Edit I have installed VPython via Terminal: pip install VPython.

Related

Why are there so many instances of Python on my system? Which one of these is my system actually using?

I'm using a Mac and this is a screenshot of the files in my /usr/local/bin
This is a screenshot of the files in /opt/homebrew/opt
I'm wondering why I have this amount of Pythons on my Mac. I feel like it's cluttered and confusing. I am also aware that the Macs have a built in Python so just to be clear, I'm not trying to get rid of that. What makes this confusing is that I don't know which Python is in use to update. Typing python3 --version returns 3.9.5 when the latest is 3.9.7. Furthermore, I thought that I had updated my Python through the official website, but found out that I just updated the IDLE that downloads when you install Python from Python.org.
Although a seemingly trivial question, any feedback and knowledge would be appreciated!
The command which python at the terminal will tell you the path of the command python. It might be a symlink so use ls -l on that path to check.

Getting Pip working in PyCharm on MacOS 10.14.5

I'm a python noob working through this intro to python: https://www.youtube.com/watch?v=rfscVS0vtbw. (definitely no need to watch this. Just adding it as context)
It's been going really well, except now I'm up to the part where I need to use pip, and despite having downloaded version 3.8 of Python, it keeps telling me that it doesn't even have pip installed.
I'm wondering if anyone could walk me through what the issue might be and how to actually start using pip in PyCharm.
I've tried downloading pip and installing it but even that doesn't seem to work. If anyone has an ultra-hand-holdy solution (very much for a noob) that would be appreciated.
I feel like the problem might be that I'm putting things in the wrong directories or something? Obviously there are some built-in versions on Python (2.x) already on the Mac so maybe they are interfering?
Thanks in advance for your help.
If I recall correctly, the version of Python that is used when you use the command python is the 2.x version, which doesn't have pip. So if you want to use python in terminal, you should call it as python3 and pip3 for using the pip command.
If you want to set a different Python version as the default one, you can do that. Here is a tutorial that can get you started with that (there's a plethora of other tutorials if this one isn't clear enough): https://opensource.com/article/19/5/python-3-default-mac
For using PyCharm specifically, you can setup the Python interpreter that is used with PyCharm by going to Preferences(or Settings) -> Project:[name of your project] -> Project Interpreter and then chose the desired Python Interpreter from the drop down menu. You can also create a virtual environment there by clicking on the cog icon and choosing Add. This is the preferred way and very convenient to keep installed packages local to your project. After you're done with that, open up PyCharms terminal (at the bottom of your PyCharm window) and you should be able to normally use pip with the command pip.
Alternatively, you can install Python packages in PyCharm using their built in package manager that you can find in the same window where you set your Python Interpreter. Below the dropdown menu you'll see a + sign, where you can click to add packages.

How to install python developer package on Windows?

I ran into the same problem as here. So I tried to install python developer package but I didn't find the way to do this.
Cython's helloworld instruction doesn't contain any info about it, which seems strange and stupid to me to not include basic requirements into instruction, named "Basic Tutorial" (Sorry if I don't get something about it.)
Anyway... I'm using Windows 10, PyCharm, virtual environment with python 3. When I went to package install window, search result contained 5 packages:
So, which one?
I tried to install one, but it gives me an error:
I met this error in the past with some other package already. PyCharm's suggestion is to run that command from terminal. But from my experience that never helped. Usually solution was either to change name (because some names are right for Python 2.x, other for Python 3.x), or to download the package (egg/wheel) manually and install it offline.
This question was asked before already, but that one is for linux, which is not the case for me.
Can someone save some time for me and future generations, please? ;)
How do I install it and make Cython's helloworld example work?

"pip" and "python" commands not found, but python3 and pip3 work fine

Just started working my way through The Hitchhiker's Guide to Python and having some trouble setting up pip and virtual environments.
I've noticed that I've had to use "python3" and "pip3" in place of "python" and "pip" (neither of the latter commands are found) but I've read that these commands should be able to be used interchangeably?
This seems to create an issue later on when setting paths for virtualenvwrapper, forcing me to deviate from the tutorial and get lost in Google search results.
How can I "find" the python and pip commands?
You will find a fairly carefully thought out answer in PEP 394. The gist is that the python command on the PATH should point to python2, not python3, by default. If a system does not have python2, it could be that it doesn't have python, but only python3.
It is perfectly acceptable for users and sysadmins to override this. I suspect your local system has a convenience tool for you to set the default invocation of python.

Is it possible to embed Jedi in an application on a system where Python is not installed?

I'm working on an (Windows and Mac) application that uses Python as an embedded scripting language.
The application includes an internal text editor, implemented using Scintilla, and I'm using Jedi for autocompletion, which generally works great.
However, when attempting autocompletion on a computer that does not have a separate installation of Python, Jedi raises an error:
jedi.api.environment.InvalidPythonEnvironment:
Could not get version information for 'python':
FileNotFoundError(2, 'The system cannot find the file specified', None, 2, None)
Digging into the code, I can see that the underlying code that is throwing the FileNotFoundError is when Jedi attempts to run python using subprocess.Popen. Python is not installed on the computer, so this fails.
I can also reproduce the same issue on a computer that does have Python installed by editing my Path environment variable not to include the location of python.exe.
Ideally, we don't want users of our application to have to install Python just to get autocompletion working.
My questions:
Is it possible to get Jedi not to spawn subprocesses, and instead run its code inside the same instance of Python within which it itself is running? I couldn't find anything about this in the documentation or the source code that deals with Environments, and extrapolating from the discussion here I suspect the answer might be no.
Is it possible somehow to get Jedi to use the same python37.dll that our application is using for its functionality, instead of looking for a .exe file that does not exist?
Is there any way we could make some kind of minimal Python installation within our existing app installation that uses the same DLLs/Python Lib etc? How could I go about doing this?
Is there any other way to get Jedi autocompletion working in our app without requiring the user to install Python, or including a full Python installer as part of our build process?
Is it possible to get Jedi not to spawn subprocesses, and instead run its code inside the same instance of Python within which it itself is running? I couldn't find anything about this in the documentation or the source code that deals with Environments, and extrapolating from the discussion here I suspect the answer might be no.
This is definitely possible. All the tools are there. There are discussions ongoing here: https://github.com/davidhalter/jedi-vim/issues/870.
IMO a patch to Jedi is needed that uses an jedi.api.environment.InterpreterEnvironment in some cases like yours. It's definitely possible, it's just buggy at the moment.

Categories

Resources