2016-07-31 442 views
0

我正在嘗試安裝pip,並且得到了一些與configparser有關的問題。不知怎的,進口configparser指向系統版本蟒蛇,蟒蛇2.7而不是3.5蟒試圖用configparser安裝pip錯誤

>> pip install -U pip 
Traceback (most recent call last): 
    File "/Users/../anaconda3/bin/pip", line 9, in <module> 
    load_entry_point('pip==8.1.2', 'console_scripts', 'pip')() 
    File "/Users/../anaconda3/lib/python3.5/site-packages/setuptools-23.0.0-py3.5.egg/pkg_resources/__init__.py", line 542, in load_entry_point 
    File "/Users/../anaconda3/lib/python3.5/site-packages/setuptools-23.0.0-py3.5.egg/pkg_resources/__init__.py", line 2569, in load_entry_point 
    File "/Users/../anaconda3/lib/python3.5/site-packages/setuptools-23.0.0-py3.5.egg/pkg_resources/__init__.py", line 2229, in load 
    File "/Users/../anaconda3/lib/python3.5/site-packages/setuptools-23.0.0-py3.5.egg/pkg_resources/__init__.py", line 2235, in resolve 
    File "/Users/../anaconda3/lib/python3.5/site-packages/pip/__init__.py", line 14, in <module> 
    from pip.utils import get_installed_distributions, get_prog 
    File "/Users/../anaconda3/lib/python3.5/site-packages/pip/utils/__init__.py", line 23, in <module> 
    from pip.locations import (
    File "/Users/../anaconda3/lib/python3.5/site-packages/pip/locations.py", line 10, in <module> 
    from distutils.command.install import install, SCHEME_KEYS # noqa 
    File "/Users../anaconda3/lib/python3.5/distutils/command/install.py", line 9, in <module> 
    from distutils.core import Command 
    File "/Users/../anaconda3/lib/python3.5/distutils/core.py", line 18, in <module> 
    from distutils.config import PyPIRCCommand 
    File "/Users/../anaconda3/lib/python3.5/distutils/config.py", line 7, in <module> 
    from configparser import RawConfigParser 
    File "/Library/Python/2.7/site-packages/configparser.py", line 12, in <module> 
    from backports.configparser import (

回答

0

修改PYTHONPATH在2.x軟件包路徑前具有python 3.x軟件包路徑

0

我假設你正在使用基於命令Linux操作系統。 試試看安裝與apt-get的

apt-get install python-pip 

時不以root身份登錄使用,你必須知道root密碼:

sudo apt-get install python-pip 

我用同樣的命令來安裝它在我的樹莓派和Ubuntu 16上

+0

這是Mac OS X ..我使用錯誤的命令?我正在嘗試更新pip和conda,但每次我都收到相同的configparser錯誤。我必須更改pythonpath嗎? – praju05

+0

試試這個適用於Mac OS的:'sudo easy-install pip' ref:http://stackoverflow.com/a/18947390/5954600 – keyur

+0

謝謝!但是安裝之後,pip install --upgrade pip會給出相同的錯誤,即沒有名爲'backports.configparser'的模塊 – praju05