2016-12-14 17 views
0

最近、Python 3.5で書かれたスクリプトを書き直したかったので、Python 2.7をインストールしました。私はパンダモジュールをインストールしたいPATH環境変数を変更した後、私は思いgettint次のエラー:pipを使用してパッケージをインストールできない

C:\Python27>pip install pandas 
Collecting pandas 
Exception: 
Traceback (most recent call last): 
    File "c:\python27\lib\site-packages\pip\basecommand.py", line 209, in main 
    status = self.run(options, args) 
    File "c:\python27\lib\site-packages\pip\commands\install.py", line 299, in run 

    requirement_set.prepare_files(finder) 
    File "c:\python27\lib\site-packages\pip\req\req_set.py", line 360, in prepare_ 
files 
    ignore_dependencies=self.ignore_dependencies)) 
    File "c:\python27\lib\site-packages\pip\req\req_set.py", line 512, in _prepare 
_file 
    finder, self.upgrade, require_hashes) 
    File "c:\python27\lib\site-packages\pip\req\req_install.py", line 273, in popu 
late_link 
    self.link = finder.find_requirement(self, upgrade) 
    File "c:\python27\lib\site-packages\pip\index.py", line 440, in find_requireme 
nt 
    all_candidates = self.find_all_candidates(req.name) 
    File "c:\python27\lib\site-packages\pip\index.py", line 398, in find_all_candi 
dates 
    for page in self._get_pages(url_locations, project_name): 
    File "c:\python27\lib\site-packages\pip\index.py", line 543, in _get_pages 
    page = self._get_page(location) 
    File "c:\python27\lib\site-packages\pip\index.py", line 646, in _get_page 
    return HTMLPage.get_page(link, session=self.session) 
    File "c:\python27\lib\site-packages\pip\index.py", line 755, in get_page 
    "Cache-Control": "max-age=600", 
    File "c:\python27\lib\site-packages\pip\_vendor\requests\sessions.py", line 48 
0, in get 
    return self.request('GET', url, **kwargs) 
    File "c:\python27\lib\site-packages\pip\download.py", line 378, in request 
    return super(PipSession, self).request(method, url, *args, **kwargs) 
    File "c:\python27\lib\site-packages\pip\_vendor\requests\sessions.py", line 46 
8, in request 
    resp = self.send(prep, **send_kwargs) 
    File "c:\python27\lib\site-packages\pip\_vendor\requests\sessions.py", line 60 
8, in send 
    r.content 
    File "c:\python27\lib\site-packages\pip\_vendor\requests\models.py", line 737, 
in content 
    self._content = bytes().join(self.iter_content(CONTENT_CHUNK_SIZE)) or bytes 
() 
    File "c:\python27\lib\site-packages\pip\_vendor\requests\models.py", line 660, 
in generate 
    for chunk in self.raw.stream(chunk_size, decode_content=True): 
    File "c:\python27\lib\site-packages\pip\_vendor\requests\packages\urllib3\resp 
onse.py", line 344, in stream 
    data = self.read(amt=amt, decode_content=decode_content) 
    File "c:\python27\lib\site-packages\pip\_vendor\requests\packages\urllib3\resp 
onse.py", line 301, in read 
    data = self._fp.read(amt) 
    File "c:\python27\lib\site-packages\pip\_vendor\cachecontrol\filewrapper.py", 
line 54, in read 
    self.__callback(self.__buf.getvalue()) 
    File "c:\python27\lib\site-packages\pip\_vendor\cachecontrol\controller.py", l 
ine 297, in cache_response 
    self.serializer.dumps(request, response, body=body), 
    File "c:\python27\lib\site-packages\pip\download.py", line 281, in set 
    return super(SafeFileCache, self).set(*args, **kwargs) 
    File "c:\python27\lib\site-packages\pip\_vendor\cachecontrol\caches\file_cache 
.py", line 99, in set 
    with self.lock_class(name) as lock: 
    File "c:\python27\lib\site-packages\pip\_vendor\lockfile\mkdirlockfile.py", li 
ne 19, in __init__ 
    LockBase.__init__(self, path, threaded, timeout) 
    File "c:\python27\lib\site-packages\pip\_vendor\lockfile\__init__.py", line 24 
2, in __init__ 
    hash(self.path))) 
    File "c:\python27\lib\ntpath.py", line 85, in join 
    result_path = result_path + p_path 
UnicodeDecodeError: 'ascii' codec can't decode byte 0xb3 in position 5: ordinal 
not in range(128) 

任意のアイデアをどのようにこの問題を克服するには?私はPython 3.5へのパスを削除したが、それは役に立たなかった。

他のパッケージもインストールできません。

+0

そうだった。それが問題を解決しました。ありがとう! –

+0

よく分かりましたが、私は自分のコメントを回答に変換しましたので、助けてくれればcouはそれを受け入れることができます。 – mata

答えて

1

これは、キャッシュディレクトリにロックファイルを作成しようとしているときに問題があるようです。通常、キャッシュに保存されているユーザーのホームディレクトリパスに非ASCII文字が含まれている可能性が高いからです。

回避策として、--no-cache-dirオプションをpipに渡すか、またはonyl ascii文字で構成される--cache-dirを明示的に渡すことができます。

0

アップグレードピップは、多くの場合、このような問題を解決しようとすることができます

pip install --upgrade pip 

そしてパンダを再インストールしようとします。

これがうまくいかない場合は、unicode文字に関するpipに既知のバグがあります。詳細はpip github pageにあります。

+0

残念ながら、pipをアップグレードしようとすると、以前と同じエラーが発生します。 –

+1

パスにユニコード文字を使用できますか? –

+0

私はそうは思わない。 C:¥Python27¥; C:¥Python27¥Scripts¥; D:¥Users¥michal_cisek¥AppData¥Local¥Programs¥MiKTeX 2.9¥miktex¥bin¥; D:¥Program Files(x86)¥Rtools \ bin \ –

0

あなたが試すことができます:

Windowsでは

pip install -U pip

python -m pip install -U pip

それとも、pipの代替としてconda installを使用することができます。 LinuxまたはMacOSで

http://conda.pydata.org/docs/install/full.html ....

関連する問題