Python no module named pip windows

I have installed pip and ez setup. I also checked the system path and I can see the module in the folder structure. Still when i try to run pip command, I get an Import error saying no module named...

I have installed pip and ez setup. I also checked the system path and I can see the module in the folder structure. Still when i try to run pip command, I get an Import error saying no module named pip. I am running 32bit python on a windows7 machine

asked Sep 17, 2015 at 20:07

Deval Pandya's user avatar

1

Just be sure that you have include python to windows PATH variable, then run python -m ensurepip

answered Mar 1, 2017 at 12:13

Gorodeckij Dimitrij's user avatar

6

After running get_pip.py with python embed you have to modify your pythonXX._pth file. Add Libsite-packages, to get something like this:

pythonXX.zip
.
Libsite-packages
# Uncomment to run site.main() automatically
#import site

If you don’t you will get this error:

ModuleNotFoundError: No module named ‘pip’

or

python-3.8.2-embed-amd64python.exe: No module named pip

λ pip
Traceback (most recent call last):
  File "runpy.py", line 193, in _run_module_as_main
  File "runpy.py", line 86, in _run_code
  File "python-3.8.2-embed-amd64Scriptspip.exe__main__.py", line 4, in <module>
ModuleNotFoundError: No module named 'pip'

λ python -m pip
python-3.8.2-embed-amd64python.exe: No module named pip

answered Mar 24, 2020 at 10:48

user2226755's user avatar

user2226755user2226755

12k5 gold badges47 silver badges73 bronze badges

5

This issue occurs with me while I was trying to upgrade pip version.
It was resolved with the following commands:

python -m ensurepip

The above command restores the pip and below mentioned upgrades it.

python -m pip install --upgrade pip 

answered Dec 9, 2020 at 20:06

raven404's user avatar

raven404raven404

8838 silver badges14 bronze badges

2

What solved the issue on my case was go to:

cd C:Program FilesPython37Scripts

And run below command:

easy_install.exe pip

answered Apr 10, 2019 at 12:51

Lucas Mota Alves's user avatar

3

try to type pip3 instead pip.
also for upgrading pip dont use pip3 in the command

python -m pip install -U pip

maybe it helps

answered Dec 17, 2016 at 19:43

Setmax's user avatar

SetmaxSetmax

9466 silver badges10 bronze badges

turned out i had 2 versions of python on my laptop

both commands worked for me

python -m ensurepip
py -m ensurepip

both with another installation path

c:toolspythonlibsite-packages
c:program files (x86)microsoft visual studiosharedpython36_64libsite-packages 

only the first path was in my %PATH% variable

answered Nov 27, 2018 at 8:55

Sloomy's user avatar

SloomySloomy

1511 silver badge6 bronze badges

0

Running these 2 commands helped me:

curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py

python get-pip.py

answered Sep 25, 2020 at 21:02

Deviljee's user avatar

DeviljeeDeviljee

711 silver badge4 bronze badges

If you wrote

pip install --upgrade pip

and you got

Installing collected packages: pip
  Attempting uninstall: pip
    Found existing installation: pip 20.2.1
    Uninstalling pip-20.2.1:
ERROR: Could not install packages due to an EnvironmentError...

then you have uninstalled pip instead install pip.
This could be the reason of your problem.

The Gorodeckij Dimitrij’s answer works for me.

python -m ensurepip

answered Oct 13, 2020 at 14:49

negas's user avatar

negasnegas

75111 silver badges9 bronze badges

I found this post while looking for a solution for the same problem. I was using an embedded python distribution. In this case, the solution is to uncomment import site in the file python<version>._pth.

answered Jul 29, 2021 at 12:52

canbooo's user avatar

canbooocanbooo

611 silver badge3 bronze badges

The ensurepip module was added in version 3.4 and then backported to 2.7.9.

So make sure your Python version is at least 2.7.9 if using Python 2, and at least 3.4 if using Python 3.

answered Feb 12, 2018 at 20:38

twasbrillig's user avatar

twasbrilligtwasbrillig

16.1k9 gold badges40 silver badges62 bronze badges

I’v solved this error by setting the correct path variables

    C:UsersnameAppDataLocalProgramsPythonPython37Scripts
    C:UsersnameAppDataLocalProgramsPythonPython37Libsite-packages

answered Jul 23, 2019 at 7:40

PratikPal's user avatar

PratikPalPratikPal

511 silver badge3 bronze badges

First make sure that python is added in environment variable.

Try checking the version of pip or pip3. Use these commands to check.

For pip:

pip --version

For pip3:

pip3 --version 

If you can see any version of pip and still not able to use it, then run the following command.

python -m ensurepip 

This ensures the pip in your system.

answered Apr 3, 2022 at 18:18

Rajan Gautam's user avatar

I was facing same issue and resolved using following steps

1) Go to your paython package and rename «python37._pth» to python37._pth.save

2) curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py

3) then run python get-pip.py

4) pip install django

Hope this help

answered Sep 15, 2019 at 5:13

vaquar khan's user avatar

vaquar khanvaquar khan

10.4k5 gold badges71 silver badges91 bronze badges

I’ve solved this error downloading the executable file for python 3.7.
I’ve had downloaded the embeddeable version and got that error.
Now it works! :D

answered Oct 16, 2018 at 2:07

Gonzalo Blotta's user avatar

The method I’m going to tell might not be the correct way to do it. But this method solved my issue. I tried every solution on youtube and StackOverflow methods.

  1. If you have two python versions installed. Delete one. I have the python 3.8.1 and 3.9.0 versions installed. I deleted version 3.9.0 from the C directory.

  2. Now go to the control panel > System and security > System > Advanced system settings.

enter image description here

Click on ‘environment variables’.

enter image description here

Select the path and click on ‘edit’

Now, add the path of the python and also the path of pip module. In my case it was c:python38 and c:python38scripts

This method solved my issue.

answered Feb 14, 2021 at 12:43

Tahil Bansal's user avatar

Instead of Python zip install python by python installer. It fixed the issue for me.

answered Aug 2, 2022 at 11:04

Abhiroop Nandi Ray's user avatar

Environment

  • pip version: 9.0.3
  • Python version: 3.6
  • OS: Windows Server 2016 Datacenter

Description
My system admin installed Python 3.6 for me in my AWS workspace and i requested him to update the pip version to 18 but while he was trying to upgrade the version, he ran into error. All below-mentioned commands were executed from a Powershell window in Administrative mode:

Output

PS D:python3.6scripts> pip install --upgrade pip
Collecting pip
  Downloading https://files.pythonhosted.org/packages/5f/25/e52d3f31441505a5f3af41213346e5b6c221c9e086a166f3703d2ddaf940
/pip-18.0-py2.py3-none-any.whl (1.3MB)
    100% |████████████████████████████████| 1.3MB 720kB/s
Installing collected packages: pip
  Found existing installation: pip 9.0.3
    Uninstalling pip-9.0.3:
Exception:
Traceback (most recent call last):
  File "d:python3.6libshutil.py", line 544, in move
    os.rename(src, real_dst)
OSError: [WinError 17] The system cannot move the file to a different disk drive: 'd:\python\3.6\scripts\pip.exe' ->
 'C:\Users\sdgadmin\AppData\Local\Temp\pip-o9ithn08-uninstall\python\3.6\scripts\pip.exe'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "d:python3.6libsite-packagespipbasecommand.py", line 215, in main
  File "d:python3.6libsite-packagespipcommandsinstall.py", line 342, in run
  File "d:python3.6libsite-packagespipreqreq_set.py", line 778, in install
  File "d:python3.6libsite-packagespipreqreq_install.py", line 754, in uninstall
  File "d:python3.6libsite-packagespipreqreq_uninstall.py", line 115, in remove
  File "d:python3.6libsite-packagespiputils__init__.py", line 267, in renames
  File "d:python3.6libshutil.py", line 559, in move
    os.unlink(src)
PermissionError: [WinError 5] Access is denied: 'd:\python\3.6\scripts\pip.exe'

PS D:python3.6scripts> pip list
Traceback (most recent call last):
  File "d:python3.6librunpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "d:python3.6librunpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "D:Python3.6Scriptspip.exe__main__.py", line 5, in <module>
ModuleNotFoundError: No module named 'pip'

PS D:python3.6scripts> pip3 install --upgrade pip
Traceback (most recent call last):
  File "d:python3.6librunpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "d:python3.6librunpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "D:Python3.6Scriptspip3.exe__main__.py", line 5, in <module>
ModuleNotFoundError: No module named 'pip'

PS D:python3.6scripts> pip3 install --upgrade pip3
Traceback (most recent call last):
  File "d:python3.6librunpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "d:python3.6librunpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "D:Python3.6Scriptspip3.exe__main__.py", line 5, in <module>
ModuleNotFoundError: No module named 'pip'

PS D:python3.6scripts> pip install --upgrade pip
Traceback (most recent call last):
  File "d:python3.6librunpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "d:python3.6librunpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "D:Python3.6Scriptspip.exe__main__.py", line 5, in <module>
ModuleNotFoundError: No module named 'pip'

PS D:python3.6scripts> pip.exe install --upgrade pip
Traceback (most recent call last):
  File "d:python3.6librunpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "d:python3.6librunpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "D:Python3.6Scriptspip.exe__main__.py", line 5, in <module>
ModuleNotFoundError: No module named 'pip'

Are we doing something wrong here? I also checked few links that suggested using easy_install. I tried that as well but ran into issues.

PS D:python3.6scripts> .easy_install.exe pip
Searching for pip
Reading https://pypi.python.org/simple/pip/
d:python3.6libsite-packagessetuptoolspep425tags.py:89: RuntimeWarning: Config variable 'Py_DEBUG' is unset, Python
 ABI tag may be incorrect
  warn=(impl == 'cp')):
d:python3.6libsite-packagessetuptoolspep425tags.py:93: RuntimeWarning: Config variable 'WITH_PYMALLOC' is unset, P
ython ABI tag may be incorrect
  warn=(impl == 'cp')):
Downloading https://files.pythonhosted.org/packages/5f/25/e52d3f31441505a5f3af41213346e5b6c221c9e086a166f3703d2ddaf940/p
ip-18.0-py2.py3-none-any.whl#sha256=070e4bf493c7c2c9f6a08dd797dd3c066d64074c38e9e8a0fb4e6541f266d96c
error: Download error for https://files.pythonhosted.org/packages/5f/25/e52d3f31441505a5f3af41213346e5b6c221c9e086a166f3
703d2ddaf940/pip-18.0-py2.py3-none-any.whl#sha256=070e4bf493c7c2c9f6a08dd797dd3c066d64074c38e9e8a0fb4e6541f266d96c: [SSL
: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:833)

This error occurs when you try to use pip, but it is not installed in your Python environment. This can happen if you skip installing pip when installing Python or when creating a virtual environment, or after explicitly uninstalling pip.

You can solve this error by downloading pip using the following curl command

curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py

Then install pip by running:

python3 get-pip.py

If this does not work, you can use ensurepip to bootstrap the pip installer into an existing Pip installation or virtual environment. For example,

# Linux
python3 -m ensurepip --upgrade

# MacOS
python3 -m ensurepip --upgrade

# Windows
py -m ensurepip --upgrade

This tutorial will go through the ways to ensure pip is installed in your environment.


Table of contents

  • Install pip by Downloading get-pip.py
  • Bootstrap pip using ensurepip
  • Install pip using Operating System Specific command
    • Installing pip for Linux
    • Installing pip for Mac Operating System
  • Upgrading pip
  • Check pip and Python version
  • Recreate Virtual Environment
  • Summary

Install pip by Downloading get-pip.py

Download pip by running the following curl command:

curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py

The curl command allows you to specify a direct download link. Using the -o option sets the name of the downloaded file.

Install pip by running:

python3 get-pip.py

Bootstrap pip using ensurepip

You can use ensurepip to bootstrap the pip installer into an existing Pip installation or virtual environment. For example,

# Linux
python3 -m ensurepip --upgrade

# MacOS
python3 -m ensurepip --upgrade

# Windows
py -m ensurepip --upgrade

Install pip using Operating System Specific command

If the above solutions do not work, you can try to install pip using the command specific to your operating system.

Installing pip for Linux

All major Linux distributions have Python installed by default. However, you will need to install pip. You can install pip from the terminal, but the installation instructions depend on the Linux distribution you are using. You will need root privileges to install pip. Open a terminal and use the commands relevant to your Linux distribution to install pip.

Installing pip for Ubuntu, Debian, and Linux Mint

sudo apt install python-pip3

Installing pip for CentOS 8 (and newer), Fedora, and Red Hat

sudo dnf install python-pip3

Installing pip for CentOS 6 and 7, and older versions of Red Hat

sudo yum install epel-release

sudo yum install python-pip3

Installing pip for Arch Linux and Manjaro

sudo pacman -S python-pip

Installing pip for OpenSUSE

sudo zypper python3-pip

Installing pip for Mac Operating System

You can install Python3 and pip3 using brew with the following command:

brew install python

Upgrading pip

You may also need to upgrade pip, which you can do with the following commands:

# Linux
python3 -m pip install --upgrade pip

# MacOS
python3 -m pip install --upgrade pip

# Windows
py -m pip install --upgrade pip

Check pip and Python version

Ensure that the Python version in use matches the pip version. You can check versions from the command line using the --version flag. For example,

python --version
Python 3.8.8
pip --version
pip 21.2.4 from /Users/Research/opt/anaconda3/lib/python3.8/site-packages/pip (python 3.8)

Note that the –version returns the version of Python is 3.8.8, and the pip installer in use is for 3.8.

Recreate Virtual Environment

If you are using a virtual environment and the error persists despite trying the above solutions, you can recreate the environment. For example,

# deactivate environment

deactivate

# remove the virtual environment folder

rm -rf venv

# Initial a new virtual environment

python3 -m venv venv

# Activate on Linux/MacOS

source venv/bin/activate

# Activate on Windows (cmd.exe)

venvScriptsactivate.bat

# Activate on Windows (PowerShell)

venvScriptsActivate.ps1

Summary

Congratulations on reading to the end of this tutorial.

Go to the online courses page on Python to learn more about Python for data science and machine learning.

For further reading on missing modules in Python, go to the article:

  • How to Solve ModuleNotFoundError: no module named ‘plotly’.
  • How to Solve Python ModuleNotFoundError: no module named ‘pymongo’
  • How to Solve Python ModuleNotFoundError: no module named ‘xgboost’

Have fun and happy researching!

Quick Fix: Python raises the ImportError: No module named 'pip' when it cannot find the library pip. The most frequent source of this error is that you haven’t installed pip explicitly with pip install pip. Alternatively, you may have different Python versions on your computer, and pip is not installed for the particular version you’re using.

Problem Formulation

You’ve just learned about the awesome capabilities of the pip library and you want to try it out, so you start your code with the following statement:

import pip

This is supposed to import the Pandas library into your (virtual) environment. However, it only throws the following ImportError: No module named pip:

>>> import pip
Traceback (most recent call last):
  File "<pyshell#6>", line 1, in <module>
    import pip
ModuleNotFoundError: No module named 'pip'

Solution Idea 1: Install Library pip

The most likely reason is that Python doesn’t provide pip in its standard library. You need to install it first!

Before being able to import the Pandas module, you need to install it using Python’s package manager pip. Make sure pip is installed on your machine.

To fix this error, you can run the following command in your Windows shell:

$ pip install pip

This simple command installs pip in your virtual environment on Windows, Linux, and MacOS. It assumes that your pip version is updated. If it isn’t, use the following two commands in your terminal, command line, or shell (there’s no harm in doing it anyways):

$ python -m pip install --upgrade pip
$ pip install pandas

💡 Note: Don’t copy and paste the $ symbol. This is just to illustrate that you run it in your shell/terminal/command line.

Solution Idea 2: Fix the Path

The error might persist even after you have installed the pip library. This likely happens because pip is installed but doesn’t reside in the path you can use. Although pip may be installed on your system the script is unable to locate it. Therefore, it is unable to install the library using pip in the correct path.

To fix the problem with the path in Windows follow the steps given next.

Step 1: Open the folder where you installed Python by opening the command prompt and typing where python

Step 2: Once you have opened the Python folder, browse and open the Scripts folder and copy its location. Also verify that the folder contains the pip file.

Step 3: Now open the Scripts directory in the command prompt using the cd command and the location that you copied previously.

Step 4: Now install the library using pip install pip command. Here’s an analogous example:

After having followed the above steps, execute our script once again. And you should get the desired output.

Other Solution Ideas

  • The ModuleNotFoundError may appear due to relative imports. You can learn everything about relative imports and how to create your own module in this article.
  • You may have mixed up Python and pip versions on your machine. In this case, to install pip for Python 3, you may want to try python3 -m pip install pip or even pip3 install pip instead of pip install pip
  • If you face this issue server-side, you may want to try the command pip install --user pip
  • If you’re using Ubuntu, you may want to try this command: sudo apt install pip
  • You can check out our in-depth guide on installing pip here.
  • You can also check out this article to learn more about possible problems that may lead to an error when importing a library.

Understanding the “import” Statement

import pip

In Python, the import statement serves two main purposes:

  • Search the module by its name, load it, and initialize it.
  • Define a name in the local namespace within the scope of the import statement. This local name is then used to reference the accessed module throughout the code.

What’s the Difference Between ImportError and ModuleNotFoundError?

What’s the difference between ImportError and ModuleNotFoundError?

Python defines an error hierarchy, so some error classes inherit from other error classes. In our case, the ModuleNotFoundError is a subclass of the ImportError class.

You can see this in this screenshot from the docs:

You can also check this relationship using the issubclass() built-in function:

>>> issubclass(ModuleNotFoundError, ImportError)
True

Specifically, Python raises the ModuleNotFoundError if the module (e.g., pip) cannot be found. If it can be found, there may be a problem loading the module or some specific files within the module. In those cases, Python would raise an ImportError.

If an import statement cannot import a module, it raises an ImportError. This may occur because of a faulty installation or an invalid path. In Python 3.6 or newer, this will usually raise a ModuleNotFoundError.

Related Videos

The following video shows you how to resolve the ImportError:

How to Fix : “ImportError: Cannot import name X” in Python?

The following video shows you how to import a function from another folder—doing it the wrong way often results in the ModuleNotFoundError:

How to Call a Function from Another File in Python?

How to Fix “ModuleNotFoundError: No module named ‘pip’” in PyCharm

If you create a new Python project in PyCharm and try to import the pip library, it’ll raise the following error message:

Traceback (most recent call last):
  File "C:/Users/.../main.py", line 1, in <module>
    import pip
ModuleNotFoundError: No module named 'pip'

Process finished with exit code 1

The reason is that each PyCharm project, per default, creates a virtual environment in which you can install custom Python modules. But the virtual environment is initially empty—even if you’ve already installed pip on your computer!

Here’s a screenshot exemplifying this for the pandas library. It’ll look similar for pip.

The fix is simple: Use the PyCharm installation tooltips to install Pandas in your virtual environment—two clicks and you’re good to go!

First, right-click on the pandas text in your editor:

Second, click “Show Context Actions” in your context menu. In the new menu that arises, click “Install Pandas” and wait for PyCharm to finish the installation.

The code will run after your installation completes successfully.

As an alternative, you can also open the Terminal tool at the bottom and type:

$ pip install pip

If this doesn’t work, you may want to set the Python interpreter to another version using the following tutorial: https://www.jetbrains.com/help/pycharm/2016.1/configuring-python-interpreter-for-a-project.html

You can also manually install a new library such as pip in PyCharm using the following procedure:

  • Open File > Settings > Project from the PyCharm menu.
  • Select your current project.
  • Click the Python Interpreter tab within your project tab.
  • Click the small + symbol to add a new library to the project.
  • Now type in the library to be installed, in your example Pandas, and click Install Package.
  • Wait for the installation to terminate and close all popup windows.

Here’s an analogous example:

Here’s a full guide on how to install a library on PyCharm.

  • How to Install a Library on PyCharm

Nerd Humor

Oh yeah, I didn’t even know they renamed it the Willis Tower in 2009, because I know a normal amount about skyscrapers. — xkcd (source)

While working as a researcher in distributed systems, Dr. Christian Mayer found his love for teaching computer science students.

To help students reach higher levels of Python success, he founded the programming education website Finxter.com. He’s author of the popular programming book Python One-Liners (NoStarch 2020), coauthor of the Coffee Break Python series of self-published books, computer science enthusiast, freelancer, and owner of one of the top 10 largest Python blogs worldwide.

His passions are writing, reading, and coding. But his greatest passion is to serve aspiring coders through Finxter and help them to boost their skills. You can join his free email academy here.

1. Overview

In this tutorial, we’ll see how to solve a popular Python error on Linux Mint and Ubuntu:

ImportError: No module named pip

The error is raised when you try to install new package or running command like:

python3 -m pip list

In the next sections we will see how to solve the error

To install pip module on Linux Mint or Ubuntu we can use apt-get and install it as follows:

sudo apt-get install python3-pip

Now after running:

python3 -m pip list

you should get something like:

Package                  Version             
------------------------ --------------------
apt-clone                0.2.1               
apturl                   0.5.2               
attrs                    19.3.0        

3. Install pip with ensurepip module

Alternatively we can install pip from Python itself by running. Most python versions are shipped with module ensurepip which can be used for installation:

python -m ensurepip --upgrade

The command above will work for Linux distros. If you like to learn more you can check: pip documentation v22.0.3.

4. Manual Installation of pip module

Finally if you prefer to manually download and install pip you can follow next steps:

  • Download the script, from https://bootstrap.pypa.io/get-pip.py
  • Open Terminal
  • move to the folder containing the get-pip.py file
  • Run python get-pip.py

Or simply:

cd ~/Downloads
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
python get-pip.py

This method is perfect if you need to install pip offline.

5. Conclusion

To conclude, this article shows how to solve the «ImportError: No module named pip» error in several different ways.

All solutions are tested on Linux Mint and Ubuntu. Some of them might work on Windows or Mac with small changes. For further reference please check the official documentation: pip installation on Linux, MacOS and Windows.

#python #windows-7 #pip

Вопрос:

Я установил установку pip и ez. Я также проверил системный путь и вижу модуль в структуре папок. Тем не менее, когда я пытаюсь запустить команду pip, я получаю сообщение об ошибке импорта, в котором говорится, что модуль с именем pip отсутствует. Я запускаю 32-битный python на машине windows7

Комментарии:

1. Просто используйте установщик python, и pip будет загружен вместе с ним.

Ответ №1:

Просто убедитесь, что у вас есть переменная пути включения python в Windows, а затем запустите python -m ensurepip

Комментарии:

1. Ошибка: python.exe: No module named ensurepip . Я использую последнюю версию 3.7.1.

2. @Subin_Learner Мне пришлось использовать установщик — ZIP-версия Python просто не работает с PIP afaict

3. @PeterX Да, вы правы. я использовал установщик, он работал.

4. не забудьте добавить C:Users…AppDataLocalProgramsPythonPython36Scripts к переменной PATH, чтобы вы могли использовать pip после

5. @PeterX, А что, если нельзя использовать установщик?

Ответ №2:

После запуска get_pip.py с python embedded вам необходимо изменить свой pythonXX._pth файл. Добавьте Libsite-packages , чтобы получить что-то вроде этого:

 pythonXX.zip
.
Libsite-packages
# Uncomment to run site.main() automatically
#import site
 

Если вы этого не сделаете, вы получите эту ошибку:

ModuleNotFoundError: Нет модуля с именем «pip»

или

python-3.8.2-embed-amd64python.exe: Нет модуля с именем pip

 λ pip
Traceback (most recent call last):
  File "runpy.py", line 193, in _run_module_as_main
  File "runpy.py", line 86, in _run_code
  File "python-3.8.2-embed-amd64Scriptspip.exe__main__.py", line 4, in <module>
ModuleNotFoundError: No module named 'pip'

λ python -m pip
python-3.8.2-embed-amd64python.exe: No module named pip
 

Комментарии:

1. Спасибо! Это помогает для моей установки Windows 10 embedded python 3.8!

2. Будьте осторожны, если вы используете virtualenv со встроенным python, окружающая среда отличается от обычной установки. Некоторые установки (с pip) могут завершиться с ошибкой типа ModuleNotFoundError: No module named '*******' .

Ответ №3:

Что решило проблему в моем случае, так это перейти к:

 cd C:Program FilesPython37Scripts
 

И выполните команду ниже:

 easy_install.exe pip
 

Комментарии:

1. Работал на меня с 2019 года. Огромное спасибо

2. У меня тоже получалось.

Ответ №4:

Комментарии:

1. Это работает; в моей установке каталог был Lib, а не lib.

2. Другой проблемой было bugs.python.org/issue34841 . Текущий каталог не был добавлен в путь. печать(sys.путь) не включала пустую строку.

Ответ №5:

Эта проблема возникает со мной, когда я пытался обновить версию pip. Это было решено с помощью следующих команд:

 python -m ensurepip
 

Приведенная выше команда восстанавливает pip и, как указано ниже, обновляет его.

 python -m pip install --upgrade pip 
 

Ответ №6:

попробуйте ввести pip3 вместо pip. также для обновления pip не используйте pip3 в команде

 python -m pip install -U pip
 

может быть, это поможет

Ответ №7:

оказалось, что у меня на ноутбуке было 2 версии python

обе команды работали на меня

 python -m ensurepip
py -m ensurepip
 

оба с другим путем установки

 c:toolspythonlibsite-packages
c:program files (x86)microsoft visual studiosharedpython36_64libsite-packages 
 

только первый путь был в моей переменной %PATH%

Ответ №8:

ensurepip Модуль был добавлен в версии 3.4, а затем перенесен обратно в 2.7.9.

Поэтому убедитесь, что ваша версия Python составляет не менее 2.7.9 при использовании Python 2 и не менее 3.4 при использовании Python 3.

Ответ №9:

Выполнение этих 2 команд помогло мне:

curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py

python get-pip.py

Ответ №10:

Я решил эту ошибку, установив правильные переменные пути

     C:UsersnameAppDataLocalProgramsPythonPython37Scripts
    C:UsersnameAppDataLocalProgramsPythonPython37Libsite-packages
 

Ответ №11:

Я нашел этот пост, когда искал решение той же проблемы. Я использовал встроенный дистрибутив python. В этом случае решение состоит в том, чтобы раскомментировать import site файл python<version>._pth .

Ответ №12:

Я столкнулся с той же проблемой и решил ее, выполнив следующие действия

1) Перейдите в свой пакет paython и переименуйте «python37._pth» в python37._pth.сохранить

2) завиток https://bootstrap.pypa.io/get-pip.py -о get-pip.py

3) затем запустите python get-pip.py

4) pip устанавливает django

Надеюсь, это поможет

Ответ №13:

Если бы вы написали

 pip install --upgrade pip
 

и ты получил

 Installing collected packages: pip
  Attempting uninstall: pip
    Found existing installation: pip 20.2.1
    Uninstalling pip-20.2.1:
ERROR: Could not install packages due to an EnvironmentError...
 

затем вы удалили pip вместо установки pip.
Это может быть причиной вашей проблемы.

Ответ Городецкого Дмитрия работает для меня.

 python -m ensurepip
 

Ответ №14:

Я решил эту ошибку, загрузив исполняемый файл для python 3.7. Я загрузил встроенную версию и получил эту ошибку. Теперь это работает! 😀

Ответ №15:

Метод, о котором я собираюсь рассказать, может оказаться неправильным способом сделать это. Но этот метод решил мою проблему. Я перепробовал все решения на YouTube и методы StackOverflow.

  1. Если у вас установлены две версии python. Удалите один. У меня установлены версии python 3.8.1 и 3.9.0. Я удалил версию 3.9.0 из каталога C.
  2. Теперь перейдите в панель управления > Система и безопасность >> Система >>> Дополнительные системные настройки.

введите описание изображения здесь

Нажмите на «переменные среды».

введите описание изображения здесь

Выберите путь и нажмите «изменить».

Теперь добавьте путь к python, а также путь к модулю pip. В моем случае это было c:python38 и c:python38scripts

Этот метод решил мою проблему.

Понравилась статья? Поделить с друзьями:
  • Python kill process by pid windows
  • Python idle for windows 7 32 bit
  • Python idle download for windows 7
  • Python ide скачать для windows 10 64 bit
  • Python ide for windows 32 bit