Python 我能';t在MacOS Sierra上安装PIP
我在Pycharm中运行Python3已有一段时间了,我试图安装一个新模块,但安装失败。具体来说,它给了我一个“非零退出代码(1)”,并告诉我尝试使用PIP从终端安装它。我已经更新并重新安装了Pycharm,但它仍然不会安装新模块 在终点站,我试图Python 我能';t在MacOS Sierra上安装PIP,python,macos,pip,homebrew,Python,Macos,Pip,Homebrew,我在Pycharm中运行Python3已有一段时间了,我试图安装一个新模块,但安装失败。具体来说,它给了我一个“非零退出代码(1)”,并告诉我尝试使用PIP从终端安装它。我已经更新并重新安装了Pycharm,但它仍然不会安装新模块 在终点站,我试图 pip --version 答复如下: -bash: pip: command not found 我查找如何安装PIP,并尝试: sudo easy_install pip 它是这样说的: Searching for pip Reading
pip --version
答复如下:
-bash: pip: command not found
我查找如何安装PIP,并尝试:
sudo easy_install pip
它是这样说的:
Searching for pip
Reading https://pypi.python.org/simple/pip/
Download error on https://pypi.python.org/simple/pip/: [SSL:
TLSV1_ALERT_PROTOCOL_VERSION] tlsv1 alert protocol version
(_ssl.c:590) -- Some packages may not be found!
Couldn't find index page for 'pip' (maybe misspelled?)
Scanning index of all packages (this may take a while)
Reading https://pypi.python.org/simple/
Download error on https://pypi.python.org/simple/: [SSL:
TLSV1_ALERT_PROTOCOL_VERSION] tlsv1 alert protocol version (_ssl.c:590)
-- Some packages may not be found!
No local packages or download links found for pip
error: Could not find suitable distribution for
Requirement.parse('pip')
所以我回到谷歌,做了更多的搜索和查找,在没有sudo的情况下尝试一下,所以
easy_install pip
然后它给了我这个:
error: can't create or remove files in install directory
The following error occurred while trying to add or remove files in the
installation directory:
[Errno 13] Permission denied: '/Library/Python/2.7/site-packages/test-
easy-install-2117.pth'
The installation directory you specified (via --install-dir, --prefix,
or the distutils default setting) was:
/Library/Python/2.7/site-packages/
Perhaps your account does not have write access to this directory? If
the installation directory is a system-owned directory, you may need to
sign in as the administrator or "root" account. If you do not have
administrative access to this machine, you may wish to choose a
different installation directory, preferably one that is listed in your
PYTHONPATH environment variable.
For information on other options, you may wish to consult the
documentation at:
https://pythonhosted.org/setuptools/easy_install.html
Please make the appropriate changes for your system and try again.
然后我发现前面的问题:
我尝试:
sudo rm -f /usr/bin/easy_install*
它给了我
rm: /usr/bin/easy_install: Operation not permitted
rm: /usr/bin/easy_install-2.6: Operation not permitted
rm: /usr/bin/easy_install-2.7: Operation not permitted
然后我发现了一个老问题:,它有两个答案说只需安装自制软件。所以我试着:
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.comnn
/Homebrew/install/master/install)"
自制软件安装完毕,我想我已经准备好了
pip --version
-bash: pip: command not found
编辑:我试过了
echo $PATH
我忘记了我最初是通过Anaconda使用Python并将其删除的,而这可能正是开始这项工作的原因。有没有办法解决这个问题?对于Mac OS Sierra,无法通过
easy\u install安装pip
因此,使用curl安装pip,如下所示
curl https://bootstrap.pypa.io/get-pip.py | sudo python
对于Mac OS Sierra,无法通过
easy\u install
因此,使用curl安装pip,如下所示
curl https://bootstrap.pypa.io/get-pip.py | sudo python
Pip已经与Python一起安装,因此如果它不起作用,那么您应该尝试重新安装Python(最新版本),然后尝试检查是否安装了Pip。如果这不起作用,那么您应该将其键入terminal-curl | sudo Python。HTH(:。我尝试重新安装python,这对我来说很有效(我也在mac上)Pip已经与python一起安装,因此如果它不起作用,那么您应该尝试重新安装python(最新版本)然后尝试检查您是否安装了pip。如果这不起作用,那么您应该将其键入terminal-curl | sudo python.HTH(:。我尝试重新安装python,这对我有效(我也在mac上)安装自制软件后,您需要启动一个新的shell。但是,我发现PyEnv更容易使用。我已经启动了一个新的shell。它仍然没有找到PIP
sudo easy\u install PIP
将尝试为您的Apple内置Python 2.7安装PIP,而不是为您正在使用的任何Python 3。关于sudo rm/usr/bin/easy\u install的答案*
对于macOS来说从来都不是一个好主意(这些文件归操作系统所有),更不用说,distribute
已经不存在了,所以……它失败了可能是件好事。最后,安装Homebrew不会安装Homebrew的Python,这是第二步,brew安装Python
。但您可能不想这样做,因为它将安装另一个Python 3,而不是修复现有的Python,并且您将必须从头开始。在安装自制软件后,你需要开始一个新的shell。但是,我发现PyEnv更容易使用。我已经开始了一个新的shell。它仍然没有发现PIPsudo easy\u install PIP
将尝试为你的苹果内置Python 2.7安装PIP,而不是为你正在使用的任何Python 3。关于sudo rm/us的答案r/bin/easy_install*
对于macOS来说从来都不是一个好主意(这些文件归操作系统所有),更不用说,distribute
已经不存在了,所以……它失败了可能是件好事。最后,安装Homebrew不会安装Homebrew的Python,这是第二步,brew安装Python
。但您可能不想这样做,因为它将安装另一个Python 3,而不是修复现有的Python,并且您将我们必须从头开始。