I have python 2.7.10 installed on windows and I am trying to install Django on the commandline with the following command:
C:/users/user/myproject> python pip install django
This displays the following error:
python: can't open file 'pip' [Errno 2] No such file or directory
Python is installed in C:\Python27 and the PATH environment variable is also set to that.
Why is pip not working?
Since Python 2.7.9 pip is included when python is installed.
However the scripts subfolder of your python installation might not be added to your PATH environment variable, and hence inaccessible by just typing pip install. However as long as your python executable is on the path, you can use the python -m flag to execute the pip module as a script:
python -m pip install SomePackage
This should work from the command line as long as python is on PATH.
If you would like to use pip directly from the cmd.exe prompt you need to add the scripts directory to your PATH environment variable:
SET PATH=%PATH%;C:\Python27\scripts
Some times in windows it especially needs Microsoft visual c++ compiler. If such error persists you can verify the log file and If needed you can download here
http://aka.ms/vcpython27
Related
I use Python 3.8.5 on Windows 10 but I still don't have pip attached with Python. I test with this
pip --version
I have followed the instruction in https://pip.pypa.io/en/stable/installing/ but my computer just do nothing after I type in
python get-pip.py
Nothing appears, no error, no instruction and now I just don't know what to do to install pip. I found nobody having the same this error.
Pip comes with Python 3.8, but is located in the Python38/Scripts directory which isn’t added to the PATH environment variable by default on Windows. What is installed in the PATH is the Python Launcher...a tool to manage multiple installations of Python.
Run py -0 to see installed Pythons, and py -m pip to run pip under the latest version of Python installed.
If you do have multiple Python versions installed, py -3.8 -m pip will run pip under that specific version of Python.
Note that if you watch the installer, you do have the option to add the Python installation directory to the path, but if you plan to ever have multiple versions of Python installed it isn’t recommended.
Download the get-pip file from this link. https://bootstrap.pypa.io/get-pip.py
Change the current path of the directory in the command line to the path of the directory where the above file exists.
Run the command :python get-pip.py
One can easily verify if the pip has been installed correctly by performing a version check on the same. Just go to the command line and execute pip -V
If still not working then edit the path variable in settings. ref link. 'pip' is not recognized as an internal or external command
My goal is to import a couple third party Python packages for use with my GIMP installation. This will allow me to use these packages when developing a GIMP plugin. I noticed a few directories that may be of use. They are as follows:
C:\Program Files\GIMP 2\32\lib\python2.7
This directory contains a site-packages folder which contains packages such as requests and pip.
C:\Program Files\GIMP 2\32\bin
This directory contains a python.exe. When I run python --version in an elevated cmd at this directory path, the output is Python 2.7.16, which I assume is GIMP 2.10's version of Python. This is important because I have my own installation of Python 3.8.0 in my Program Files. If I'm anywhere outside of this path in the cmd, the version that outputs is 3.8.0.
I have added these directories to my PATH system variable and tried running pip install but the output tells me I have already installed the requested third party packages. The problem is that they are installed to my Python 3.8.0 installation. I'm trying to run pip install in the context of GIMP's Python environment.
Any advice would be much appreciated.
Grab get-pip.py here
Put it into your GIMP Python directory (C:\Program Files\GIMP 2\Python)
From a Windows Command Prompt Window cd to that directory
Run get-pip with this python instance: .\python.exe get-pip.py. You now have pip installed in the GIMP version of Python.
You can now use this pip instance with Gimp's Python runtime: .\python.exe -m pip install --user <package>
Uplifted/adapted from here
Turns out the package I was trying install had dependencies that required a higher version of Python than the one GIMP comes with. Thanks to those whom responded.
I am a beginner and read somewhere that we should always create virtual environments when working with Python. Therefore, I created a virtual environment using:
python -m virtualenv headlines
It copies all files with messages like
Using base prefix 'C:\\Program Files\\Python 3.5'
New python executable in C:\Users\Babu\headlines\Scripts\python.exe
Installing setuptools, pip, wheel...
Now, I want to install a module locally in this virtual environment using the following command:
python -m pip install feedparser
I think it is being installed in the Program Files Directory in Python 3.5 folder because the console shows:
copying build\lib\feedparser.py -> c:\program files\python 3.5\Lib\site-packages
error: could not create 'c:\program files\python 3.5\Lib\site-packages\feedparser.py': Permission denied
How can I resolve that?
I assume that you have already virtual environment folder successfully created.
First of all, you should be "inside" in your virtualenv in order to use it, thus for linux environments:
~$ source ${your_venv_folder_name}/bin/activate
will cause command line look like this
(venv)~$
Or for windows environments, like this:
python -m venv ${your_venv_folder_name}
According to this manual
python 3.4
If Python 3.4 is installed it is not necessary to install virtualenv
separately. Instead it is possible to use the venv module:
python < 3.4
virtualenv can be installed using the previously installed pip:
pip.exe install virtualenv
Now I see that you haven't enough permissions to install additional modules, so try to restart cmd terminal with administrator privileges according to this manual
Now then, with venv activated in current console and have sufficient privileges, it's should be easy to install modules from pip as usual.
I have using Python 3.4 in my machine . I have installed the same machine Python 2.7 and do what necessary in Environment Path . In Python34 folder I have changed python.exe to python3.exe . I can use Python2.7 using python command and Python3.4 using python3 command.But there was an error usin pip :
Fatal error in launcher: Unable to create process using '"C:\Python3.4\python.exe" "C:\Python3.4\Scripts\pip.exe" install'
As you see pip still using python.exe . How can I solve this ?
I'll try to be as clear as I can here, the answer you've linked to in the comments above is specifically asking about being able to run multiple versions of python on the same machine, and being able to specify which version is used to run a script from the command line.
when python 3 is installed two executables are added to c:\Windows\ called py.exe and pyw.exe these are used by default when a python script is invoked by double clicking on it in explorer.
if no other command line arguments are set then these executables look inside the script for the shebang line which looks like #!python2 or #!python3.3 and direct the py (or pyw) executable to use that version of python to run the script, note that this could just be #!python which would use the first version found on the system (oldest first) also note that only 2 significant digits can be used (so you couldn't use #!python3.3.4). If no shebang line is found, the first version of python found will be used.
to use a specific version of python from the command line you would then have a couple of options, firstly you could specify the entire path to the python version you want, e.g. C:\Python33\python.exe scriptname.py or you can use flags.
To use a flag you would call py -3.3 scriptname.py which would call the python 3.3 interpreter and pass it the script as an argument for you.
this prevents you needing to mess about with executable names, by messing with the executable names you are breaking your own pip installation. in short there is no reason you should ever need to rename them.
I have the same error when I install python2.7 and python3.6 in my Window7.
After I rename my python.exe, there was an error using pip.
If your pip is the last version,you have to reinstall your pip use the command python3 -m pip install --upgrade --force-reinstall pip.
If your pip is not the last verison ,you can just upgrade your pip with the command python3 -m pip install --upgrade pip.
NOTE. When you install pip for your python2, you hava to change the command as python2 -m pip install --upgrade --force-reinstall pip.
Hope it works for you~
I installed the latest version of Python from www.python.org. Python 3.4.3. I then go to run pip and I get
"Fatal error in launcher: Job information querying failed"
Searching for this error message points me to similar issues running Python under wine. If you grab a pre-compiled pip.exe it will work but it seems that when you install, the pip.exe is generated as part of the installer and this pip.exe does not work.
Further I am dealing with a build script that creates a virtual python environment that uses pip.exe and results in the same error. Not sure how to fix this. Also not sure how pip.exe is generated.
You can use python -m pip install package
Worked for me in windows 10, make sure that you have added python in path of system environment variable. If you are able to run python from powershell then it means python is added to your path. After that you may try using following to upgrade pip
python -m pip install -U pip