probably was asked 100 times but I will try once again ( maybe will get a simple answeR)
I used the commands:
url https://bootstrap.pypa.io/get-pip.py -o get-pip.py
python3 get-pip.py
from a mac terminal to install pip. When I am going to the IDLE shell window and I am typing :
pip3 install numpy
I am getting a syntax error even though it's supposed to work.
Can somebody explain to me what is the issue?
I am not keen on downloading Anaconda as I like to keep my environment simple enough.
I am working with a mac notebook. any help will be most appreciated.
Thanks, YK
The IDLE shell window is a Python interpreter and only understand python syntax. Since pip3 install numpy is not valid Python, you get a syntax error. Instead, you need to open Terminal and type the command there.
You cant install packages through the python idle.
Try installing numpy through your mac terminal.
If it still does not work check if pip is even installed by pip --version or pip3 --version. The reason that downloading a package in the python IDLE does not work is because the python IDLE only understands valid python code(it is a python interpreter), and because pip3 install numpy is not python code it does not work
Related
I am a newbie in Python and had a problem with installing Python packages on my windows computer.
I installed Python itself and then had to install the packages "Numpy" and "Matplotlib" as well. My teacher told us to do it with the commands:
python -m pip install --upgrade pip
pip install numpy
pip install matplotlib
I managed to install Python but when I run the first command to install pip I got the error message telling me that Python is not found. I found the command py -m pip --version here and it worked. After running it pip got installed and I got the message "pip 22.3 from C:\Users\Kaja\Programs\Python\Python310\lib\site-packages\pip (python 3.10)". I guessed this message means that its working.
I had a similar problem with the commands to install Numpy and Matplotlib. It only worked with this commands
py -m pip install numpy
py -m pip install matplotlib
I searched the internet and found this question telling me to run the command doskey py=python and it did not work. But when I swapped py and python so that the command was doskey python=py I eventually could run my teachers commands.
I checked the windows documentation and they are using the same commands as my teacher. I am very curious to know why I had this problem because on my fellow students computers it worked without the doskey command.
Edit:
Thank you very much #RustyPython.
I checked my environment variables and the path to the python.exe was already there.
Out of curiousity I deleted the python.exe from the path variable and although I did that the commands still worked! Another thing I tried was to remove the doskey macro like discribed in this article but still the commands still run without any errors.
I think its something else.
When you install python on windows it usually comes with the python launcher. This provides a way to easily access all the python versions installed on your computer.
The python launcher uses the py command which access the default python version.
py -0p will show you all the installed versions.
See https://www.infoworld.com/article/3617292/how-to-use-pythons-py-launcher-for-windows.html for more details.
For the python command to work then the relevant directory containing python.exe needs to be added to your user PATH variable.
As has been said looks the the python directory is not on your PATH, but the python launcher is and finds the installed python.exe.
If you want python to work on command line then you'll need to add it to your PATH variable. https://realpython.com/add-python-to-path/#how-to-add-python-to-path-on-windows
I have a problem with installing numpy with python 3.6 and i have windows 10 64 bit
Python 3.6.6
But when i typed python on cmd this appears
Python is not recognized as an internal or external command
I typed py it solves problem but how can i install numpy
I tried to type commant set path =c:/python36
And copy paste the actual path on cmd but it isnt work
I tried also to edit the enviromnent path through type a ; and c:/python 36 and restart but it isnt help this
I used pip install nupy and download pip but it isnt work
Try pip3 install numpy. To install python 3 packages you should use pip3
On Windows, the py command should be able to launch any Python version you have installed. Each Python installation has its own pip. To be sure you get the right one, use py -3.6 -m pip instead of just pip.
You can use where pip and where pip3 to see which Python's pip they mean. Windows just finds the first one on your path.
If you activate a virtualenv, then you you should get the right one for the virtualenv while the virtualenv is active.
Question: How do you use pip when cmd does not recognize python or pip but python 3.7 shell recognizes pip?
More Details: I am a beginner coder (5-6 months in) and I installed python 3.7 a while back and to test for pip I typed in import pip in the shell with no error. Unfortunately when I typed in python -V or pip -V into cmd It said python or pip was not recognized by the cmd. I don't know why this happened so I looked online and I found this
about getting the cmd to recognize pip but it did not help very much. When I tried to install pyaudio using pip install pyaudio in cmd it did not recognize pip once again. I do apologize for the poor wording on this question. Thank you
Have tried to reinstall the python with enabling the Add PATH option??
This is happening due to path issue, you can try this also.
goto python lib location via cmd after that try pip install {Module Nmae }
have u tried typing pip3 instead of pip ?
also make sure your python is in your sytem PATH.
I am having trouble with PIP right now. When I installed python, I check the box to install pip together. Python itself works fine, but PIP does not work. Whenever I type pip in command line on Windows (no matter 8.1 or 10, I just fallback and re-upgrade my laptop), it will do nothing but keep freezing at this point and even ctrl-C is not working.
What should I do to solve this problem? I've tired to resintall python on 2.7.9, 2.7.10, 3.4.3, 3.5, they all have same problem, it seems not the python but some dll is missing(I guess).
What it looks like when freezing
What it looks like when calling with -v and install package('Django')
Try python -m pip install Django. I had the same problem with pip today and it worked for me.
Check out the log file created by the pip whenever you invoke the pip command. The log file is situated generally at
C:\Users\user_name\pip
The notepad file will be created and you can verify what is missing
I'm trying to install a charting tool (matplotlib-v1.4.2) for python 3.4 in Windows 7, so far all my trails doesn't seem to do the job.
Attempts:
I've downloaded pip from GitHub
python -m pip install matplotlib on Command Prompt[DOS] - No Use
There's a similar question posted here, tried these suggestions too but I get the following error
'$' is not reconginized as an internal or external command.
I'm sure I'm missing something, your step by step guidance on this regard would be much appreciated.
The $ refers to the beginning of a shell prompt, you shouldn't actually include it in your command :)
So rather than (from the example question you posted)
$ pip install requests
you actually type
pip install requests
In any case, you can download matplotlib .exe files from here for use in Windows. Make sure you get the correct bitness (32bit vs 64bit) and the correct Python version.
$ in the example signifies the linux prompt, which in windows is usually >
You can install the library by either using pip install, or using this link http://matplotlib.org/downloads.html
Additionally, most python packages for windows can be easily installed by using the installers from this site http://www.lfd.uci.edu/~gohlke/pythonlibs/