在windows下cmd升级pip出错:
Collecting pip
Exception:
Traceback (most recent call last):
File "C:\Python27\lib\site-packages\pip\basecommand.py", line 215, in main
status = self.run(options, args)
File "C:\Python27\lib\site-packages\pip\commands\install.py", line 324, in run
requirement_set.prepare_files(finder)
File "C:\Python27\lib\site-packages\pip\req\req_set.py", line 380, in prepare_files
ignore_dependencies=self.ignore_dependencies))
File "C:\Python27\lib\site-packages\pip\req\req_set.py", line 620, in _prepare_file
session=self.session, hashes=hashes)
File "C:\Python27\lib\site-packages\pip\download.py", line 821, in unpack_url
hashes=hashes
File "C:\Python27\lib\site-packages\pip\download.py", line 659, in unpack_http_url
hashes)
File "C:\Python27\lib\site-packages\pip\download.py", line 880, in _download_http_url
file_path = os.path.join(temp_dir, filename)
File "C:\Python27\lib\ntpath.py", line 85, in join
result_path = result_path + p_path
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc1 in position 7: ordinal not in range(128)
You are using pip version 9.0.1, however version 18.0 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.
执行代码:python -m pip install -U pip 还是不能升级pip
其实是跟安装了两个python版本有关
找半天原因没找到,直接使用:eash_install --upgrade pip 来升级pip
C:\Users\
92143
>easy_install --upgrade pip
Searching
for
pip
Reading https:
//pypi.python.org/simple/pip/
Best match: pip
10.0
.
1
Processing pip-
10.0
.
1
-py3.
6
.egg
pip
10.0
.
1
is already the active version in easy-install.pth
Installing pip-script.py script to c:\python36-
32
\Scripts
Installing pip.exe script to c:\python36-
32
\Scripts
Installing pip.exe.manifest script to c:\python36-
32
\Scripts
Installing pip3-script.py script to c:\python36-
32
\Scripts
Installing pip3.exe script to c:\python36-
32
\Scripts
Installing pip3.exe.manifest script to c:\python36-
32
\Scripts
Installing pip3.
6
-script.py script to c:\python36-
32
\Scripts
Installing pip3.
6
.exe script to c:\python36-
32
\Scripts
Installing pip3.
6
.exe.manifest script to c:\python36-
32
\Scripts
Using c:\python36-
32
\lib\site-packages\pip-
10.0
.
1
-py3.
6
.egg
Processing dependencies
for
pip
Finished processing dependencies
for
pip
升级成功后不能安装python中的requests模块
出现以下错误:UnicodeDecodeError: 'ascii' codec can't decode byte 0xc1 in position 7: ordinal not in range(128)
解决办法:
在python安装目录 Python27\Lib\site-packages 中新建一个文件sitecustomize.py
内容写:
import sys
sys.setdefaultencoding(‘gb2312’)