简体   繁体   中英

Python: pip is installed but not working in windows

I have installed python 3.6.0, you don't need to install pip manually if you are using python (>3.3). But When I am trying to access pip (pip --version), it throws me two errors which mainly relate to not finding the module. Description is given below.

C:\Users\sharma6>pip --version
Traceback (most recent call last):
  File "c:\python360\lib\site-packages\pip\_vendor\requests\packages\__init__.py", line 27, in <module>
    from . import urllib3
  File "c:\python360\lib\site-packages\pip\_vendor\requests\packages\urllib3\__init__.py", line 8, in <module>
    from .connectionpool import (
  File "c:\python360\lib\site-packages\pip\_vendor\requests\packages\urllib3\connectionpool.py", line 7, in <module>
    from socket import error as SocketError, timeout as SocketTimeout
  File "c:\python360\lib\socket.py", line 49, in <module>
    import _socket
zipimport.ZipImportError: can't find module '_socket'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "c:\python360\lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "c:\python360\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "C:\python360\Scripts\pip.exe\__main__.py", line 5, in <module>
  File "c:\python360\lib\site-packages\pip\__init__.py", line 21, in <module>
    from pip._vendor.requests.packages.urllib3.exceptions import DependencyWarning
  File "c:\python360\lib\site-packages\pip\_vendor\requests\__init__.py", line 62, in <module>
    from .packages.urllib3.exceptions import DependencyWarning
  File "c:\python360\lib\site-packages\pip\_vendor\requests\packages\__init__.py", line 29, in <module>
    import urllib3
ModuleNotFoundError: No module named 'urllib3'

Even when I import socket (>>>import socket)in python interpreter , It shows me "Can not found the module" error .

>>> import socket
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\python352\lib\socket.py", line 49, in <module>
    import _socket
zipimport.ZipImportError: can't find module '_socket

Could someone tell me about the errors and how to resolve them because I need pip to work properly.

Add your all path in your system variable instead of adding in user variable. It worked for me!!! :)

You should try to write

python -m pip --version

If this gives an error message, install pip by downloading get-pip.py from https://pip.pypa.io/en/stable/installing/ and install with

python get-pip.py

Installing with pip is then done by

python -m pip install [package name]

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM