I downloaded Python 3.9 but nothing seems to have happened - python

Ok, I'm trying to install python 3.9 in my computer. The only thing I know about computers is programming, and I'm starting with Python. I really don't understand much of anywhere before that, so that's why I couldn't get what I'm looking for in other StackOverflow questions and so on. I have a hard time in that. Therefore, I'll describe exactly what I did:
I went to https://www.python.org/ and downloaded Python 3.9 (that button in the middle).
After it finished downloading, I opened it and went through the installation window. After it was done, I went to my Terminal (after I figured out what it was) and typed which python. This is where the problem starts; I got a pretty neutral return (just the path):
/usr/bin/python
After that, I did python. Then there was a problem:
WARNING: Python 2.7 is not recommended.
This version is included in macOS for compatibility with legacy software.
Future versions of macOS will not include Python 2.7.
Instead, it is recommended that you transition to using 'python3' from within Terminal.
Python 2.7.16 (default, Apr 17 2020, 18:29:03)
[GCC 4.2.1 Compatible Apple LLVM 11.0.3 (clang-1103.0.29.20) (-macos10.15-objc- on darwin
Type "help", "copyright", "credits" or "license" for more information.
All I understand is that the computer still has Python 2.7.16 installed (which, if I understand correctly, is a default for Mac), and not the 3.9. In the tutorial I was watching, this didn't happen... What can I do?
EDIT: By the way, the commands python3.9 and python3.9.0 gave the same error message:
>>> python3.9
File "<stdin>", line 1
python3.9
^
SyntaxError: invalid syntax
>>> python3.9.0
File "<stdin>", line 1
python3.9.0
^
SyntaxError: invalid syntax

Errors and lines beginning with >>> suggest you're still inside Python2 interpreter. You need to exit it before trying to run Python3. You can do that by pressing the Ctrl and d buttons on your keyboard at the same time, or typing exit().
After exiting, you should be able to run python3.

looks like your python is linked to python2.7 instead of python3.
just type python3 on commandline, this should solve your problem. you can check the version by typing python3 --version on commandline.
the same should work for pip3

The best easy way is to use anadonda based python or intel based.
Anaconda based python for MacOS
This should work for you.

Related

Updated: TENSORFLOW Activating Virtualenv through Terminal is not Working

macOS High Sierra 10.13.2 — MacBook (Retina, 12-inch, Early 2016)
Trying to set up Python TensorFlow NOT because I like Python (hate it) but because that was what was recommended
NOTE: Not very experienced with Terminals and whatnot, but an okay programmer.
NEW PROBLEMS:
My computer seemed to have downloaded TensorFlow, but when following the steps to test it, this showed up:
Macbook:~ rose$ cd Desktop
Macbook:Desktop rose$ Python
Python 2.7.10 (default, Jul 15 2017, 17:16:57)
[GCC 4.2.1 Compatible Apple LLVM 9.0.0 (clang-900.0.31)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
import tensorflow as tf
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named tensorflow
EVERYTHING seemed fine when I finished the steps for installation...
So, I was thinking today that it would be pretty awesome to see if I could figure out how to set up some sort of neural network programming environment on my computer and eventually found TensorFlow. Everything was going pretty well, I was just following the instructions on this page at the official site for instructions. I installed pip, Virtualenv, nose/tornado (said I needed them, created a Virtualenv environment for Python 3.n, which I updated to today, then got to this step:
Activate the Virtualenv environment by issuing one of the following commands:
$ cd targetDirectory
$ source ./bin/activate # If using bash, sh, ksh, or zsh
$ source ./bin/activate.csh # If using csh or tcsh
I used the command it said to use for bash (wow, these names are horrible and nondescript), but I'm not 100% sure I use bash, almost certain because that is supposed to be the default on Mac and got this:
Input:
Macbook:~ rose$ source ./bin/activate
Error Message Output:
-bash: ./bin/activate: No such file or directory
NOTE: There were some other messages, here are screens of the whole shell.
Screenshots on my GitHub Pages
You haven't created a virtual environment. There were errors. Please reread carefully your own screenshots, last but one and the last.
Cannot copy/paste the error message here from the images. That's one of many reasons why images without text are bad.

Unable to import nltk on mac os x

I had successfully installed nltk from this site. And just to validate i am able to import it from the terminal. But when i execute my python script from the Spyder it gives me following error in Spyders terminal
File "/Prateek/Python/RC_ISSUES/algorithm_RC.py", line 9, in <module>
import nltk
ImportError: No module named nltk
Below output is from the terminal
I know there might be similar questions but i thought it is different from rest of the other questions
When you execute a python script, the operating system is looking for the interpreter as specified on the first line of the script, which most of the time is:
#!/usr/bin/python
On Mac OS X, this is the python as distributed with the system when you installed it, which is the one distributed with the system. It is usually very likely to be the one that has the older compilation date:
2.7.10 (default, Jun 1 2015, 09:45:55) [GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.57)]
If you do type python in your shell, you're very likely to see another path to that interpreter, e.g. if you installed the brew version of python:
% type python
python is /usr/local/bin/python
So you have two ways around it, either you explicitly launch your script with python:
python algorithm_RC.py
in doubt, use the full path you found out with type:
/usr/local/bin/python algorithm_RC.py
or, you can change your script first line with:
#!/usr/bin/env python
which will use the same python as the one you're reaching from your shell. You can also use the full path to your manually installed python, by making that line:
#!/usr/local/bin/python
or whatever the type command gave. But I would advise you against that, as the /usr/bin/env solution is more flexible and makes sure you're using in both cases the same python from the shell and within the script.
Finally, you can also use the system's python by calling explicitly easy_install from /usr/bin:
sudo /usr/bin/pip nltk
And if you don't have pip there, then you'll have to install it first:
sudo /usr/bin/easy_install pip
HTH
try 1:
>>>import nltk
and hit enter and now try
>>>nltk.download()

vim-ipython failed on Windows 7

I installed iPython by Anaconda on Windows 7. (There's no python installed previously). I can run ipython without problem.
Then I installed vim-ipython plugin. In vim, when I run
:IPython
I got this:
E492 Not an editor command.
I checked vim version:
:version
+python/dyn
I checked (in vim)
:python import sys
E370 Could not load python27.dll
Run python on cmd:
Python 2.7.5 |Anaconda 1.7.0 (64-bit)| (default, Jul 1 2013, 12:37:52) [MSC v.1500 64 bit (AMD64)]
Could you please tell me what is wrong with this installation?
Thank you.
Edit:
I tried (in Vim):
:echo has("python")
0
I get really confused!
Edit 2:
Thanks for everybody's help. I decide to build/compile vim 64-bit on windows. I've downloaded MinGW-w64, but don't know how to use it: I can't find 'make'. (I remember there's mingw-32-make in the 32 bit version, but none in the 64-bit version.)
On windows for vim to find python DLL path to it must be present in $PATH. There are multiple ways to achieve this:
Editing registry. On wine I achieve this by adding a new path to the value of PATH key stored inHKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment by creating path.reg file:
REGEDIT4
[HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment]
"PATH"="{put old value of %PATH% here};C:\\path\\to\\python\\dll"
and running regedit path.reg, but I guess HKEY_LOCAL_MACHINE is a bit of overkill and you need something under HKEY_CURRENT_USER. I am using it with wine (windows emulator) anyway so I do not care. You can launch regedit without arguments and try to find something there.
AFAIR there is a way to set %PATH% in a link file you use to launch vim.
Maybe just putting the following into the vimrc will work:
let $PATH.=';C:\path\to\python\dll'
Note: none of the advices will work if vim was compiled with different python version support. Also if some configure flags (e.g. debugging support) differ between python from anaconda installer and python used by the whoever compiled vim error message should change. I do not know whether error message will change if vim is 32-bit and your python is 64-bit, but loading python will for sure fail in this case.
Your troubleshooting output shows that your Vim is compiled with dynamically loaded Python (+python/dyn), but the error you get and has('python') == 0 means that the Python interpreter cannot be successfully loaded. The IPython plugin probably has a guard clause that prevents its loading unless Python is available.
You need to fix the Python integration into Vim, either by making that DLL available to Vim (so that there'll be no errors and has('python') == 1), or (as a last resort) compiling Vim yourself.

ipython under Emacs for WIndows hangs shell

Hi I recently downloaded ipython 0.12.1 – April 2012 and got it to work under Windows' terminal. i.e. I open a command prompt and type ipython and then the ipython prompt appears.
All good and dandy until I needed to use it in emacs. So before even trying to use the pyton-mode.el or ipython.el (which at the moment freeze my emacs ), I tried to do a M-x shell or M-x eshell
and type ipython -i.
This is the trace I get before a complete hang of the shell:
ipython -i
Python 2.7.2 (default, Jun 12 2011, 15:08:59) [MSC v.1500 32 bit (Intel)]
Type "copyright", "credits" or "license" for more information.
IPython 0.12.1 -- An enhanced Interactive Python.
? -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help -> Python's own help system.
object? -> Details about 'object', use 'object??' for extra details.
WARNING: Readline services not available or not loaded.WARNING: Proper color support under MS Windows requires the pyreadline library.
You can find it at:
http://ipython.org/pyreadline.html
Gary's readline needs the ctypes module, from:
http://starship.python.net/crew/theller/ctypes
(Note that ctypes is already part of Python versions 2.5 and newer).
Defaulting color scheme to 'NoColor'
So why does it hang in the emacs shell and work in a regular command prompt. Do I need to change my default emacs shell? I also tried this on two different machines. Am I missing something?
Well apparently the only way to do this under Windows is to create a batch file, even though in the 0.12 distribution there exists an executable (ipython.exe). My script reads as follows:
[ipython.bat]
#python.exe -i C:\devel\Python\2.7-bin\Scripts\ipython-script.py --pylab %*
For the users of matplotlib and numpy under Windows, the pylab option still doesn't work correctly as it will freeze your figure windows. To get that working, I had to revert to ipython 0.10 and use the -wthread option rather than -pylab in the ipython.bat script. This actually produces a nice interactive-figure environment

"import wx" fails after installation of wxPython on Windows XP

I downloaded and installed this version of wxPython for use with my Python 2.6 installation:
http://downloads.sourceforge.net/wxpython/wxPython2.8-win32-unicode-2.8.9.1-py26.exe
When I run Python and try to import wx, I get the following error:
C:\Program Files\Console2>python
Python 2.6 (r26:66721, Oct 2 2008, 11:35:03) [MSC v.1500 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import wx
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "c:\Python26\lib\site-packages\wx-2.8-msw-unicode\wx\__init__.py", line 45, in <module>
from wx._core import *
File "c:\Python26\lib\site-packages\wx-2.8-msw-unicode\wx\_core.py", line 4, in <module>
import _core_
ImportError: DLL load failed: This application has failed to start because the application configuration is incorrect. Reinstalling the application may fix this problem.
>>>
I have already tried removing wxPython and installing again and I got the same error. How can I fix this problem?
I was getting the same error.
After some googling found this link to MSVC++ 2008 Redestributable and installed it.
That solved the problem.
Hate to say this, but I had the same problem, and and import worked fine after a reboot.
Copy the Microsoft C runtime library v.9 files and manifest. That is, msvcr90.dll and microsoft.vc90.crt.manifest from folder python to the folder wx, tha is, folder which contains failed to start DLLs.
Or install the Visual C++ 2008 Redistributable Package.
From looking for "application configuration is incorrect" in the wxPython trac system, the only reference that might make sense is a 64-bit vs 32-bit compatibility issue.
Otherwise, I'd say Brian's answer of trying ANSI is pretty good.
BTW, if you try uninstalling again, make go into the site-packages folder and make sure all the wx and wxPython stuff is deleted.
Try the ANSI version instead of the Unicode one. IIRC it needs to match the Python 2.6 install to work properly.
I too have the same issue.Better install "Portable Python" IDE which comes with some nice modules including wxPython .You can start coding GUI immediately without the need to download a separate wxPython.The link ,
http://www.portablepython.com/
Maybe too late, but I had the same problem and solved that by downloading that from their own website : wxPython2.8-win64-unicode-py27
In my case it initially wanted to setup in somewhere else than my python folder. So I changed it to be in ../python27/Lib/SitePackages/
Then it worked properly.
I hope it helps.
Another late answer, but I recently had issues (8/14) and my solution was to use the 32-bit instead of 64-bit wxPython version.
you try to use the module wxpython 2.8.12.1 version, select the version of your python. you can download it here:
http://www.lfd.uci.edu/~gohlke/pythonlibs/#wxpython

Categories