Re: >>> %matplotlib inline results in SyntaxError: invalid syntax
On 2023-12-25 19:53, Alan Gauld via Python-list wrote: On 25/12/2023 05:34, geetanajali homes via Python-list wrote: import numpy as np import pandas as pd import random import matplotlib.pyplot as plt %matplotlib inline I get an error on the last line. I am running this code in Idle Python 3.4.4 Shell... Python names can't start with a % (its the modulo or string formatting operator). I know nothing of the innards of matplotlib so I can only suggest a closer examination of their tutorial information. I believe it's a feature of Jupyter specifically. It won't work in IDLE. -- https://mail.python.org/mailman/listinfo/python-list
Re: >>> %matplotlib inline results in SyntaxError: invalid syntax
On Tue, 26 Dec 2023 at 07:27, Chris Grace via Python-list wrote: > I'd also recommend a newer version of python. Python 3.4 reached end of > life almost 5 years ago. Uhh, putting this in perspective... until a spammer revived the thread just now, it was asked, answered, and finished with, all back in 2016. I don't think anyone's still waiting on answers here. ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: >>> %matplotlib inline results in SyntaxError: invalid syntax
"%matplotlib inline" is a magic command that changes how plots render when working with IPython. Read more here: https://stackoverflow.com/a/43028034 The article you linked assumes you are working in an IPython shell, not IDLE. This is common in the data science world. You may already have IPython installed. Try running it from a command line with `python -m IPython`. If that doesn't work, you can first install it with `python -m pip install IPython`, then run the 1st command. IPython is commonly used as a Jupyter Notebook kernel. See https://jupyter-notebook-beginner-guide.readthedocs.io/en/latest/index.html for more information about Jupyter Notebook. I'd also recommend a newer version of python. Python 3.4 reached end of life almost 5 years ago. Some of the packages used in the linked article no longer officially support python 3.4. That doesn't necessarily mean that you'll experienced issues using python 3.4, but much has changed in the 7 years since that article was written. On Mon, Dec 25, 2023, 2:53 PM Alan Gauld via Python-list < python-list@python.org> wrote: > On 25/12/2023 05:34, geetanajali homes via Python-list wrote: > > >> import numpy as np > >> import pandas as pd > >> import random > >> import matplotlib.pyplot as plt > >> %matplotlib inline > >> > >> I get an error on the last line. I am running this code in Idle Python > >> 3.4.4 Shell... > > Python names can't start with a % (its the modulo or > string formatting operator). > > I know nothing of the innards of matplotlib so I can only > suggest a closer examination of their tutorial information. > > -- > Alan G > Author of the Learn to Program web site > http://www.alan-g.me.uk/ > http://www.amazon.com/author/alan_gauld > Follow my photo-blog on Flickr at: > http://www.flickr.com/photos/alangauldphotos > > > -- > https://mail.python.org/mailman/listinfo/python-list > -- https://mail.python.org/mailman/listinfo/python-list
Re: >>> %matplotlib inline results in SyntaxError: invalid syntax
On 25/12/2023 05:34, geetanajali homes via Python-list wrote: >> import numpy as np >> import pandas as pd >> import random >> import matplotlib.pyplot as plt >> %matplotlib inline >> >> I get an error on the last line. I am running this code in Idle Python >> 3.4.4 Shell... Python names can't start with a % (its the modulo or string formatting operator). I know nothing of the innards of matplotlib so I can only suggest a closer examination of their tutorial information. -- Alan G Author of the Learn to Program web site http://www.alan-g.me.uk/ http://www.amazon.com/author/alan_gauld Follow my photo-blog on Flickr at: http://www.flickr.com/photos/alangauldphotos -- https://mail.python.org/mailman/listinfo/python-list
Re: Python 3.12.1, Windows 11: shebang line #!/usr/bin/env python3 doesn't work any more
Well spotted Chris. 4 was a generalisation based on my own circumstances.However, I'm not wrong about Microsoft motivationsM--(Unsigned mail from my phone) Original message From: Chris Angelico via Python-list Date: 25/12/23 15:57 (GMT+10:00) To: Michael Torrie via Python-list Subject: Re: Python 3.12.1, Windows 11: shebang line #!/usr/bin/env python3 doesn't work any more On Mon, 25 Dec 2023 at 15:42, Mike Dewhirst via Python-list wrote:>> Apologies for top posting - my phone seems unable to do otherwise.>> Here's my view - which may not be popular.You're right about that part, anyhow :)> 4. Shebang lines are pretty much redundant now that most python interpreters are run from venvsStrongly dispute that. The rest. you're entitled to your opinions(they happen to be wrong, but you're entitled to them :) ), but thisis a statement of fact that I would need to see some evidence for.ChrisA-- https://mail.python.org/mailman/listinfo/python-list -- https://mail.python.org/mailman/listinfo/python-list
Re: >>> %matplotlib inline results in SyntaxError: invalid syntax
On Friday 29 January 2016 at 12:34:47 UTC+5:30, Mike S wrote: > I have installed Python 3.4.4 on XPSP3 and am trying to work my way > through this tutorial. > > A Complete Tutorial on Ridge and Lasso Regression in Python > http://www.analyticsvidhya.com/blog/2016/01/complete-tutorial-ridge-lasso-regression-python/ > > > In Step 2 "Why Penalize the Magnitude of Coefficients?" we are shown > this code: > > #Importing libraries. The same will be used throughout the article. > import numpy as np > import pandas as pd > import random > import matplotlib.pyplot as plt > %matplotlib inline > > I get an error on the last line. I am running this code in Idle Python > 3.4.4 Shell... > > Python 3.4.4 (v3.4.4:737efcadf5a6, Dec 20 2015, 19:28:18) [MSC v.1600 32 > bit (Intel)] on win32 > Type "copyright", "credits" or "license()" for more information. > >>> import numpy as np > >>> import pandas as pd > >>> import random > >>> import matplotlib.pyplot as plt > >>> %matplotlib inline > SyntaxError: invalid syntax > > What am I doing wrong? Suggested reading? > TIA, > Mike best commercial property in noida... https://sayastatus129.in/ https://sikkamallnoida.com/ https://paras133.com/ https://gygynoida.in/ https://experion45noida.in/ https://krasacentrade.com/ -- https://mail.python.org/mailman/listinfo/python-list
Re: Python 3.12.1, Windows 11: shebang line #!/usr/bin/env python3 doesn't work any more
On Sun, 24 Dec 2023 22:55:34 +, Barry wrote: >> On 24 Dec 2023, at 00:54, rbowman via Python-list >> wrote: >> >> Does that work with virtualenv or conda? I'm slowly getting up to speed >> with those. > > Conda is its own thing, not need for py.exe. > > Once you have created the venv you do not need py.exe as you will have > pythob.exe in the venv bin folder. Thanks. That's what I have been doing and have never used py.exe. For context Esri distributes ArcPy as a scripting language using 3.9. By default the base install can't be modified so if you want additional libraries or a tool like Spyder it has to be in a virtual. -- https://mail.python.org/mailman/listinfo/python-list