python3: install packages via pip on Windows with parallel python2

1

After installing (in said order)

  • python 2.7
  • python 3.5

on Windows 7 I want to

  • install python (site-)packages for python3.5, e.g. pylint
  • but keep python 2.7 as default python (in PATH variable)

However when calling pip directly I get no information

D:\Program Files\Python35\Scripts>pip3.5.exe install pylint

D:\Program Files\Python35\Scripts>

and pylint is not importable afterwards.
Also I couldn't install successfully from python IDLE via import pip:

Python 3.5.2 (v3.5.2:4def2a2901a5, Jun 25 2016, 22:18:55) [MSC v.1900 64 bit (AMD64)] on win32
Type "copyright", "credits" or "license()" for more information.
>>> import pip
>>> pip.main("install pylint".split())
Collecting pylint
  Using cached pylint-1.7.1-py2.py3-none-any.whl
...
Collecting wrapt (from astroid>=1.5.1->pylint)
  Using cached wrapt-1.10.10.tar.gz
[31mException:
Traceback (most recent call last):
  File "D:\Program Files\Python35\lib\site-packages\pip\basecommand.py", line 209, in main
    status = self.run(options, args)
  ....
  File "D:\Program Files\Python35\lib\site-packages\pip\compat\__init__.py", line 73, in console_to_str
    return s.decode(sys.__stdout__.encoding)
AttributeError: 'NoneType' object has no attribute 'encoding'[0m
[33mYou are using pip version 8.1.1, however version 9.0.1 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.[0m
2

hardmooth

Posted 2017-06-15T15:05:19.900

Reputation: 145

Answers

1

The way to go was

  • start CMD (admin), CD to python3 install path

    D:\Program Files\Python35>python.exe
    Python 3.5.2 (v3.5.2:4def2a2901a5, Jun 25 2016, 22:18:55) [MSC v.1900 64 bit (AMD64)] on win32 
    Type "help", "copyright", "credits" or "license" for more information.
    >>> quit()
    

    (started python just to check python version)

  • use (python3) pip from CMD as follows:

    D:\Program Files\Python35>python.exe -m pip install pylint
    Collecting pylint
      Using cached pylint-1.7.1-py2.py3-none-any.whl
    ...
    Successfully installed astroid-1.5.3 colorama-0.3.9 isort-4.2.15 lazy-object-proxy-1.3.1 mccabe-0.6.1 pylint-1.7.1 six-1.10.0 wrapt-1.10.10
    

hardmooth

Posted 2017-06-15T15:05:19.900

Reputation: 145