升级pip卸载了我的点子,现在我无法在Mac OS X上重新安装它

时间:2018-05-24 10:38:41

标签: python pip

编辑:忘记在Mac OS X 10.10.5 Yosemite上添加,

这是我永远不会更新我的点子的原因之一,因为我担心这会发生,我会打破一些向后兼容性......唉。

我升级了我的点子,突然间一切都崩溃了,现在我无法让它发挥作用。

Last login: Thu May 24 10:52:09 on ttys000
Hi Jan
~> pip install pandas
Requirement already satisfied: pandas in /usr/local/lib/python2.7/site-packages
Requirement already satisfied: pytz>=2011k in /usr/local/lib/python2.7/site-packages (from pandas)
Collecting python-dateutil>=2.5.0 (from pandas)
/usr/local/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:318: SNIMissingWarning: An HTTPS request has been made, but the SNI (Subject Name Indication) extension to TLS is not available on this platform. This may cause the server to present an incorrect TLS certificate, which can cause validation failures. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/security.html#snimissingwarning.
  SNIMissingWarning
/usr/local/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:122: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/security.html#insecureplatformwarning.
  InsecurePlatformWarning
/usr/local/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:122: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/security.html#insecureplatformwarning.
  InsecurePlatformWarning
/usr/local/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:122: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/security.html#insecureplatformwarning.
  InsecurePlatformWarning
  Downloading https://files.pythonhosted.org/packages/cf/f5/af2b09c957ace60dcfac112b669c45c8c97e32f94aa8b56da4c6d1682825/python_dateutil-2.7.3-py2.py3-none-any.whl (211kB)
    100% |################################| 215kB 2.7MB/s
Requirement already satisfied: numpy>=1.9.0 in /usr/local/lib/python2.7/site-packages (from pandas)
Requirement already satisfied: six>=1.5 in /usr/local/lib/python2.7/site-packages (from python-dateutil>=2.5.0->pandas)
Installing collected packages: python-dateutil
  Found existing installation: python-dateutil 2.4.2
    Uninstalling python-dateutil-2.4.2:
      Successfully uninstalled python-dateutil-2.4.2
Successfully installed python-dateutil-2.7.3
You are using pip version 9.0.0, however version 10.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.

所以基本上我试图再次安装pandas,因为我的dateutil突然崩溃了...与构建fontcache有什么关系?我不知道我认为重新安装会解决问题。然后它建议我升级我的点子。我不情愿地尝试升级我的点子,

~> pip install --upgrade pip
zsh: correct 'pip' to '.pip' [nyae]? n

/usr/local/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:318: SNIMissingWarning: An HTTPS request has been made, but the SNI (Subject Name Indication) extension to TLS is not available on this platform. This may cause the server to present an incorrect TLS certificate, which can cause validation failures. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/security.html#snimissingwarning.
  SNIMissingWarning
/usr/local/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:122: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/security.html#insecureplatformwarning.
  InsecurePlatformWarning
/usr/local/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:122: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/security.html#insecureplatformwarning.
  InsecurePlatformWarning
Collecting pip
/usr/local/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:122: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/security.html#insecureplatformwarning.
  InsecurePlatformWarning
  Downloading https://files.pythonhosted.org/packages/0f/74/ecd13431bcc456ed390b44c8a6e917c1820365cbebcb6a8974d1cd045ab4/pip-10.0.1-py2.py3-none-any.whl (1.3MB)
    100% |################################| 1.3MB 811kB/s
Installing collected packages: pip
  Found existing installation: pip 9.0.0
    Uninstalling pip-9.0.0:
Exception:
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/site-packages/pip/basecommand.py", line 215, in main
    status = self.run(options, args)
  File "/usr/local/lib/python2.7/site-packages/pip/commands/install.py", line 342, in run
    prefix=options.prefix_path,
  File "/usr/local/lib/python2.7/site-packages/pip/req/req_set.py", line 778, in install
    requirement.uninstall(auto_confirm=True)
  File "/usr/local/lib/python2.7/site-packages/pip/req/req_install.py", line 752, in uninstall
    paths_to_remove.remove(auto_confirm)
  File "/usr/local/lib/python2.7/site-packages/pip/req/req_uninstall.py", line 115, in remove
    renames(path, new_path)
  File "/usr/local/lib/python2.7/site-packages/pip/utils/__init__.py", line 267, in renames
    shutil.move(old, new)
  File "/usr/local/Cellar/python/2.7.8_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 303, in move
    os.unlink(src)
OSError: [Errno 13] Permission denied: '/usr/local/lib/python2.7/site-packages/pip-9.0.0.dist-info/DESCRIPTION.rst'
You are using pip version 9.0.0, however version 10.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
exit 2

好。拉屎。它中途停了下来,现在我完全没有点钱了!

~>
exit 2
~> pip install dateutil
zsh: command not found: pip
exit 127
~> pip
zsh: command not found: pip
exit 127
~> pip install
zsh: correct 'pip' to 'pp' [nyae]? n
zsh: command not found: pip
exit 127
~>
exit 127
~>
exit 127
~> pip
zsh: correct 'pip' to 'pp' [nyae]? n
zsh: command not found: pip
exit 127
~>
exit 127
~> pip install
zsh: correct 'pip' to 'pp' [nyae]? n
zsh: command not found: pip
exit 127
~> pip install
zsh: correct 'pip' to 'pp' [nyae]? n
zsh: command not found: pip
exit 127
~>
exit 127
~>
exit 127

这里我尝试使用curl来安装pip:不工作,

~> curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 1603k  100 1603k    0     0   724k      0  0:00:02  0:00:02 --:--:--  724k
~> python get-pip.py
Collecting pip
  Using cached https://files.pythonhosted.org/packages/0f/74/ecd13431bcc456ed390b44c8a6e917c1820365cbebcb6a8974d1cd045ab4/pip-10.0.1-py2.py3-none-any.whl
Collecting wheel
/var/folders/47/2fdkbcyx0pzf0l9pprsl8ksw0000gn/T/tmpCLBru6/pip.zip/pip/_vendor/urllib3/util/ssl_.py:339: SNIMissingWarning: An HTTPS request has been made, but the SNI (Subject Name Indication) extension to TLS is not available on this platform. This may cause the server to present an incorrect TLS certificate, which can cause validation failures. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
/var/folders/47/2fdkbcyx0pzf0l9pprsl8ksw0000gn/T/tmpCLBru6/pip.zip/pip/_vendor/urllib3/util/ssl_.py:137: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
/var/folders/47/2fdkbcyx0pzf0l9pprsl8ksw0000gn/T/tmpCLBru6/pip.zip/pip/_vendor/urllib3/util/ssl_.py:137: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
  Downloading https://files.pythonhosted.org/packages/81/30/e935244ca6165187ae8be876b6316ae201b71485538ffac1d718843025a9/wheel-0.31.1-py2.py3-none-any.whl (41kB)
    100% |################################| 51kB 4.2MB/s
praw 3.5.0 has requirement six==1.10, but you'll have six 1.11.0 which is incompatible.
Installing collected packages: pip, wheel
  Found existing installation: pip 9.0.0
    Uninstalling pip-9.0.0:
Could not install packages due to an EnvironmentError: [Errno 13] Permission denied: '/usr/local/lib/python2.7/site-packages/pip-9.0.0.dist-info/DESCRIPTION.rst'
Consider using the `--user` option or check the permissions.

You are using pip version 9.0.0, however version 10.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.

然后我尝试使用easy_install来安装pip,也没有用,

exit 1
~> pip
zsh: correct 'pip' to 'pp' [nyae]? n
zsh: command not found: pip
exit 127
~> pip install
zsh: correct 'pip' to 'pp' [nyae]? n
zsh: command not found: pip
exit 127
~> pip install 9.0.0
zsh: correct 'pip' to 'pp' [nyae]? n
zsh: command not found: pip
exit 127
~> easy_install -U pip
zsh: correct 'pip' to '.pip' [nyae]? n
Traceback (most recent call last):
  File "/usr/local/bin/easy_install", line 5, in <module>
    from pkg_resources import load_entry_point
  File "/usr/local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2928, in <module>
    @_call_aside
  File "/usr/local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2914, in _call_aside
    f(*args, **kwargs)
  File "/usr/local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2941, in _initialize_master_working_set
    working_set = WorkingSet._build_master()
  File "/usr/local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 637, in _build_master
    return cls._build_from_requirements(__requires__)
  File "/usr/local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 650, in _build_from_requirements
    dists = ws.resolve(reqs, Environment())
  File "/usr/local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 829, in resolve
    raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'setuptools==5.4.2' distribution was not found and is required by the application
exit 1

一些更加绝望的尝试,

~> which pip
zsh: correct 'pip' to '.pip' [nyae]? n
pip not found
exit 1
~> sudo easy_install pip
zsh: correct 'pip' to '.pip' [nyae]? n
Password:
Traceback (most recent call last):
  File "/usr/local/bin/easy_install", line 5, in <module>
    from pkg_resources import load_entry_point
  File "/usr/local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2928, in <module>
    @_call_aside
  File "/usr/local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2914, in _call_aside
    f(*args, **kwargs)
  File "/usr/local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2941, in _initialize_master_working_set
    working_set = WorkingSet._build_master()
  File "/usr/local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 637, in _build_master
    return cls._build_from_requirements(__requires__)
  File "/usr/local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 650, in _build_from_requirements
    dists = ws.resolve(reqs, Environment())
  File "/usr/local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 829, in resolve
    raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'setuptools==5.4.2' distribution was not found and is required by the application
exit 1
~>

我通常只是那种阅读说明并按照列出的命令行事的人,但我通过升级破坏了我的点子,但我重新安装时遇到了麻烦。

编辑:已解决此问题

~> curl https://bootstrap.pypa.io/ez_setup.py -o - | python
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 12537  100 12537    0     0  71398      0 --:--:-- --:--:-- --:--:-- 71640
ez_setup.py is deprecated and when using it setuptools will be pinned to 33.1.1 since it's the last version that supports setuptools self upgrade/installation, check https://github.com/pypa/setuptools/issues/581 for more info; use pip to install setuptools
Downloading https://pypi.io/packages/source/s/setuptools/setuptools-33.1.1.zip
Extracting in /var/folders/47/2fdkbcyx0pzf0l9pprsl8ksw0000gn/T/tmpdT5I0V
Now working in

 ...

Installed /usr/local/lib/python2.7/site-packages/setuptools-33.1.1-py2.7.egg
Processing dependencies for setuptools==33.1.1
Finished processing dependencies for setuptools==33.1.1

~> sudo easy_install pip==9.0.0
Searching for pip==9.0.0
Best match: pip 9.0.0
Adding pip 9.0.0 to easy-install.pth file
Installing pip script to /usr/local/bin
Installing pip3.5 script to /usr/local/bin
Installing pip3 script to /usr/local/bin

Using /usr/local/lib/python2.7/site-packages
Processing dependencies for pip==9.0.0
Finished processing dependencies for pip==9.0.0

3 个答案:

答案 0 :(得分:0)

尝试

sudo apt-get install python-pip

因为消息显示Permission Denied并且您的点数似乎已被卸载。

答案 1 :(得分:0)

这是一个权限错误。

下载pip后如下:

curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py

尝试这样做:

sudo python get-pip.py

而不只是python get-pip.py

答案 2 :(得分:0)

您必须从Linux命令行重新安装pip:

卸载 在Debian / Ubuntu上卸载PIP(检查python版本)

# sudo apt remove python-pip    #python 2
# sudo apt remove python3-pip   #python 3

在CentOS和RHEL上卸载PIP

# sudo yum remove epel-release 
# sudo yum instremove python-pip

然后重新安装:

在Debian / Ubuntu上安装PIP(检查python版本)

# sudo apt install python-pip   #python 2
# sudo apt install python3-pip  #python 3

在CentOS和RHEL上安装PIP

# sudo yum install epel-release 
# sudo yum install python-pip