get-pip.py raises ValueError when run in IDLE - python

enter image description hereI need to install PIP for Python 2.7.3.
I have run the get-pip.py file in Python IDLE shell. However, it raises the following exception:
ValueError: Unable to configure handler 'console': closed
Here is the screenshot:
How can fix this error?
Here is the error faced when trying to execute python get-pip.py in the command prompt:
inspite of correct path no execution result

You need to run Python as an elevated process in order to have write access to the program files directory where pip will get installed. The simplest and best way to do that is to launch an elevated command prompt cmd.exe.
In Windows 7 and later, you can best do that by opening the start menu using the Windows key, and then typing cmd. This should give you the command prompt as the first result. Right click on it, and choose “Run as administrator”. After accepting the UAC dialogue, this will then start an elevated command prompt with proper write access.
The run the script, then use the following command as explained in the pip installation manual:
python get-pip.py
Of course you need to adjust the path to the get-pip.py file. For example if the file is in your downloads folder, you can write the following:
python C:\Users\<username>\Downloads\get-pip.py
This should the properly install pip for the current Python version.
Note that in order to use pip later, you also need to run it always from an elevated command prompt, as every PyPI module is also installed into the Python directory in your program files (unless you’re using virtual environments of course). So you then need to run e.g. pip install beautifulsoup4. If pip.exe is not in your path, which likely be the case, you can also run pip using the Python executable like this: python -m pip install beautifulsoup4.

Related

Python was not found after closing commandline. Windows opens app store when I type python

I have downloaded and installed python from here.
Then I restarted and opened a commandline and typed
python --version
I recorded all my actions, so I can post a screenshot of that:
It works and shows the version number.
Then I performed the following steps to install Jupyter because I want to use a local runtime with Google Colab:
In the Windows commandline (not in the Python window!!), I type this:
pip install virtualenv
python -m pip install --upgrade pip
virtualenv opencv (I guess I can choose a random name here because we will not be using OpenCV, right? But for simplicity, I keep this name now)
I CD to c:\users\MYUSERNAME\opencv\Scripts
activate.bat
pip install numpy
python -m pip install jupyter
Now my browser opens this page: http://localhost:8888/tree
Now I click "New" and "Python 3 (ipykernel)"
Now I want to install the extension jupyter_http_over_ws.
I type:
pip install jupyter_http_over_ws
Nothing shows up when I type text on the keyboard. It looks like this:
Because I want to be able to type again, I close the command line and open it again.
Now I type again:
pip install jupyter_over_http_ws
It says
The command "pip" has been misspelt oder was not found.
Because I have no idea what is happening, I type:
python --version
I am expecting that it shows the version number like before.
But instead it shows
"Python was not found."
Why is that?
ps: When I type "python", it starts the Microsoft App Store and offers me to download it:
Thank you!
What happens if you add your python installation path to the environment variables?
https://www.educative.io/answers/how-to-add-python-to-path-variable-in-windows
Don't forget to restart Windows after adding the path!

Have problem to run Python command installed by pip in macOS Terminal

I'm not a Python user, so know little about Python. But I have to install stcgal using pip3 following its official guide.
pip3 install stcgal
However, if I run the installed command in terminal, it says zsh: command not found.
After a long searching, I find it was installed at /Users/myUserName/Library/Python/3.8/bin/. Though I can run the command with that path, it's very inconvenient. I wonder is there any way to run the code in any directory instead having to locate it explicitly?
Try something like this:
python -m stcgal -h
You can create or edit your /Users/yimingliu/.zshrc file (if your macOS is older than macOS Catalina 10.15, then the file is /Users/yimingliu/.bash_profile), and add a line to add the python bin folder to your path:
export PATH=/Users/yimingliu/Library/Python/3.8/bin:$PATH

How to create an executable with a pycharm python file though pyinstaller?

I have been trying to install pyinstaller in order to create an executable of a python project I have been working on, but my pip command simply doesn't work. This is the error I would get "'pip' is not recognized as an internal or external command, operable program or batch file". I have already checked the interpreter of my pycharm project, and it shows that it has pip already installed. I tried to look this up online, and I found out that a problem could be that the environment variable Path just needs to have the directory of my python version, but even after doing this, it still would not work. For additional information, I already tried to find the directory by using the command "where python" in the command prompt, but that path didn't work, and I'm using windows 10.
Usually for most of users, there would be a problem as you mention above. In such situation, you just need to install pip again with command like
python -m pip3 install -U pip
and remember next time, if pip reminds you to upgrade it, do not just use
pip install -U pip

I can't use pip (Windows)

I'm wanting to learn machine learning, but it requires that I use 'pip.' I'm still very new to a lot of this stuff. I've installed Python 3.4 64-bit and get-py.py.
When I run pip install sklearn I get 'pip' is not recognized as an internal or external command, operable program or batch file.
Here's a screenshot of my environmental variable PATH
https://gyazo.com/c7ec926401878845d5c4f9a556cf00ee
Any help would be greatly appreciated. I have checked out other posts where people had similar issues, but I tried various things and nothing worked.
Easiest solution is to just download a platform like Anaconda for example. It is Python with many libraries (sklearn, pandas, numpy, ...) and also with pip, all in a user-friendly Windows installer package, that takes care of everything for you.
https://www.continuum.io/downloads
If you really want to do it yourself, then
download get-pip.py (https://bootstrap.pypa.io/get-pip.py)
make sure you have Python installed and in your PATH, for example by running python --version in command prompt
Navigate to the directory, where you downloaded get-pip.py (in command prompt using the command cd).
Run the command python get-pip.py from a command prompt with admin privileges (possibly not needed, but just to make sure).
This should be all. Close your command prompt, open it again and run pip --version to test it. If it doesn't work, then search your computer for a file named pip.exe (most likely in your Python directory) and if you find it, add its path to your PATH variable (given the screenshot, I assume you know how to do this).
I downloaded Python 3.6 and the pip was installed on my system.
I found pip at below location:
C:\Users\Admin\AppData\Local\Programs\Python\Python36\Scripts
Also, before I found pip I used below command on my command prompt to install pyperclip:
python -m pip install pyperclip
For anyone that might have installed Python using the MSI installer, and ticked the box to include pip, but still gets the error 'pip' is not recognized as an internal or external command, operable program or batch file:
It looks like that the pip executable is installed in the \Scripts subdirectory of the Python installation, but that directory does not get automatically added to PATH.
For me, since I had installed Python 2.7, the directory was C:\Python27\Scripts. After adding this path to the PATH environment variable, and open a new CMD window, pip was available as a command.
I've made a workaround that will help you, copy the batch script below and modify it as specified:
#"PATH to python.exe" "PATH to pip.exe" %*
For example like this:
#"C:\programming\bin\python374\python.exe" "C:\programming\bin\python374\Scripts\pip.exe" %*
Save this file as pip.bat on Desktop and then move it to C:\Windows\system32.
For Python 3.7 or higher at least (as today is October 4th 2019) in the installation window you need to check the box "add to PATH" when you first install Python.
I'm late now, but just add python to your environment variables.
It´s explained in this short video, how to set up python to your environment variables:
https://www.youtube.com/watch?v=Y2q_b4ugPWk
after that pip should work on your cmd prompt, without cd to
"C:\Users\Admin\AppData\Local\Programs\Python\Python36\Scripts"
This is late but in case anyone runs across this issue, pip installed for me as "pip3". Once I used pip3 as my command and not pip, it worked fine. Threw me for quite a loop since I've been using Python for years.
PIP Install and Upgrade
Ensure you are accessing the right location while accessing pip as shown in my link above. Starting Python 3.4, it is included by default with the Python binary installers.
Environment Variable
It is also a good idea to update the environment variable if the path is not accessible by default, once the installation is complete.
If it is specifically pip you want you could install python again making sure to tick the install pip box which it sounds like you failed to upon initial installation.

python unable to use .whl files

I am trying to install pymedia, but I can't. I know I need pip, but I can't get pip. on every tutorial, it always says to do
python -m ensurepip
but for me it always just says
'python' is not recognized as an internal or external command,
operable program or batch file.
I have windows 7 64 bit and python 2.7
It seems that python is not on your path.
Check if the python directory with python.exe is listed in the environment variable PATH. If not, just add it and try again.
You should be able to start python shell by running python in command line.
You have 2 easy options. First you need to be running pip from your scrips folder in the python directory.
Download your whl file and place it in the scripts folder where your pip.exe is.
In command prompt (windows) type:
#note the exact file path may be different but should look something like this.
cd C:\program files\Python\Scripts
after you are in your scripts folder in command prompt you can then run the command:
pip install nameofpackage.whl
note if you have more than one python version installed make sure you are running pip in the correct directory and if you have 2.X and 3.X installed you may want to use pip3 instead of pip
For windows users your second option here:
like the first option make sure you are in your scripts folder in command prompt then you can run a command to install your whl file on a local directory:
pip install C:/path/to/dir/with/filename.whl

Categories

Resources