安装后(按上述顺序)
- 蟒蛇2.7
- 蟒蛇3.5
在 Windows 7 上我想要
- 安装适用于 python3.5 的 python (site-) 包,例如
pylint
- 但保留 python 2.7 作为默认 python(在 PATH 变量中)
但是当直接调用 pip 时我没有得到任何信息
D:\Program Files\Python35\Scripts>pip3.5.exe install pylint
D:\Program Files\Python35\Scripts>
之后无法pylint
导入。
此外,我无法通过以下方式从 python IDLE 成功安装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
答案1
要走的路是
启动CMD(管理员),CD到python3安装路径
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()
(启动python只是为了检查python版本)
从 CMD 使用(python3)pip 如下:
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