我很难用pip来安装几乎任何东西。我是编码的新手,所以我想也许这是我一直做错的事情,并选择了easy_install以获得我需要做的大部分工作,这通常都有效。但是,现在我正在尝试下载nltk库,并且都没有完成任务。
我尝试进入
sudo pip install nltk
但得到了以下回复:
/Library/Frameworks/Python.framework/Versions/2.7/bin/pip run on Sat May 4 00:15:38 2013
Downloading/unpacking nltk
Getting page https://pypi.python.org/simple/nltk/
Could not fetch URL [need more reputation to post link]: There was a problem confirming the ssl certificate: <urlopen error [Errno 1] _ssl.c:504: error:0D0890A1:asn1 encoding routines:ASN1_verify:unknown message digest algorithm>
Will skip URL [need more reputation to post link]/simple/nltk/ when looking for download links for nltk
Getting page [need more reputation to post link]/simple/
Could not fetch URL https://pypi.python. org/simple/: There was a problem confirming the ssl certificate: <urlopen error [Errno 1] _ssl.c:504: error:0D0890A1:asn1 encoding routines:ASN1_verify:unknown message digest algorithm>
Will skip URL [need more reputation to post link] when looking for download links for nltk
Cannot fetch index base URL [need more reputation to post link]
URLs to search for versions for nltk:
* [need more reputation to post link]
Getting page [need more reputation to post link]
Could not fetch URL [need more reputation to post link]: There was a problem confirming the ssl certificate: <urlopen error [Errno 1] _ssl.c:504: error:0D0890A1:asn1 encoding routines:ASN1_verify:unknown message digest algorithm>
Will skip URL [need more reputation to post link] when looking for download links for nltk
Could not find any downloads that satisfy the requirement nltk
No distributions at all found for nltk
Exception information:
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip-1.3.1-py2.7.egg/pip/basecommand.py", line 139, in main
status = self.run(options, args)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip-1.3.1-py2.7.egg/pip/commands/install.py", line 266, in run
requirement_set.prepare_files(finder, force_root_egg_info=self.bundle, bundle=self.bundle)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip-1.3.1-py2.7.egg/pip/req.py", line 1026, in prepare_files
url = finder.find_requirement(req_to_install, upgrade=self.upgrade)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip-1.3.1-py2.7.egg/pip/index.py", line 171, in find_requirement
raise DistributionNotFound('No distributions at all found for %s' % req)
DistributionNotFound: No distributions at all found for nltk
--easy_install installed fragments of the library and the code ran into trouble very quickly upon trying to run it.
关于这个问题的任何想法?我非常感谢有关如何获得pip工作或在此期间解决问题的一些反馈。
答案 0 :(得分:127)
我发现将pypi主机指定为受信任是足够的。示例:
pip install --trusted-host pypi.python.org pytest-xdist
pip install --trusted-host pypi.python.org --upgrade pip
这解决了以下错误:
Could not fetch URL https://pypi.python.org/simple/pytest-cov/: There was a problem confirming the ssl certificate: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:600) - skipping
Could not find a version that satisfies the requirement pytest-cov (from versions: )
No matching distribution found for pytest-cov
2018年4月更新: 对于任何得到TLSV1_ALERT_PROTOCOL_VERSION错误的人:它与OP的可信主机/验证问题或此答案无关。而是TLSV1错误是因为您的解释器不支持TLS v1.2,您必须升级您的解释器。例如,请参阅https://news.ycombinator.com/item?id=13539034,http://pyfound.blogspot.ca/2017/01/time-to-upgrade-your-python-tls-v12.html和https://bugs.python.org/issue17128。
2019年2月更新: 对于某些人来说,升级点数可能就足够了。如果上述错误阻止您执行此操作,请使用get-pip.py。例如。在Linux上,
curl https://bootstrap.pypa.io/get-pip.py
sudo python get-pip.py
答案 1 :(得分:36)
我使用了pip版本9.0.1
并遇到了同样的问题,上面的所有答案都没有解决问题,而且由于其他原因我无法使用brew安装python / pip。
将pip升级到9.0.3
解决了这个问题。因为我无法用pip升级pip,所以我下载了源代码并手动安装了它。
sudo python3 pip-9.0.3.tar.gz
- 安装pip 或者您可以安装较新的点子:
curl https://bootstrap.pypa.io/get-pip.py | python
答案 2 :(得分:30)
Pypi删除了对小于1.2的TLS版本的支持
您需要重新安装Pip,执行
curl https://bootstrap.pypa.io/get-pip.py | python
或全球Python:
curl https://bootstrap.pypa.io/get-pip.py | sudo python
答案 3 :(得分:27)
最简单的解决方法是将pip降级为不使用SSL的pip:easy_install pip==1.2.1
。这会使您失去使用SSL的安全优势。真正的解决方案是使用链接到更新SSL库的Python发行版。
答案 4 :(得分:26)
我使用了pip3版本pip3 install
,但最近无法通过命令10.11.5
安装任何软件包。
Mac os版本:EI Captain 3.5
。
python版本:curl https://bootstrap.pypa.io/get-pip.py | python
我尝试了命令:
10.0.0
它对我不起作用。
所以我通过输入以下内容卸载旧点并安装了最新版本python3 -m pip uninstall pip setuptools
curl https://bootstrap.pypa.io/get-pip.py | python3
:
sudo -i
现在我的问题解决了。 如果你使用python2,你可以用python替换python3。我希望它也适合你。
顺便说一句,对于像我这样的新手,你必须输入代码:
public class MenuActivity extends AppCompatActivity {
private BottomNavigationView.OnNavigationItemSelectedListener mOnNavigationItemSelectedListener
= new BottomNavigationView.OnNavigationItemSelectedListener() {
@Override
public boolean onNavigationItemSelected(@NonNull MenuItem item) {
switch (item.getItemId()) {
case R.id.navigation_home:
// mTextMessage.setText(R.string.title_home);
return true;
case R.id.navigation_dashboard:
// mTextMessage.setText(R.string.title_dashboard);
return true;
case R.id.navigation_notifications:
// mTextMessage.setText(R.string.title_notifications);
return true;
}
return false;
}
};
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_menu);
BottomNavigationView navigation = (BottomNavigationView) findViewById(R.id.navigationBar);
navigation.setOnNavigationItemSelectedListener(mOnNavigationItemSelectedListener);
}}
获得正确的权利:)祝你好运!
答案 5 :(得分:17)
SSL错误的另一个原因可能是系统时间不合理 - 如果距离现在太远,证书将无法验证。
答案 6 :(得分:10)
唯一对我有用的解决方案是:
sudo curl https://bootstrap.pypa.io/get-pip.py | sudo python
答案 7 :(得分:6)
要安装任何其他软件包,我必须使用最新版本的pip,因为django.db.models.fields.mixins
存在此SSL问题。要通过pip本身升级pip,我必须先解决这个SSL问题。
为了跳出这个无限循环,我发现这只适用于我的方式。
9.0.1
文件。sudo pip install pip-10.0.1-py2.py3-none-any.whl
现在pip是最新版本,可以安装任何东西。
答案 8 :(得分:5)
我通过添加--trusted-host pypi.python.org
选项
答案 9 :(得分:4)
解决方案 - 通过标记以下主机信任
来安装任何软件包临时解决方案
pip install --trusted-host pypi.python.org --trusted-host pypi.org --trusted-host files.pythonhosted.org {package name}
永久性解决方案 - 将您的PIP(版本9.0.1的问题)更新为最新版本。
pip install --trusted-host pypi.python.org --trusted-host pypi.org --trusted-host files.pythonhosted.org pytest-xdist
python -m pip install --trusted-host pypi.python.org --trusted-host pypi.org --trusted-host files.pythonhosted.org --upgrade pip
答案 10 :(得分:3)
对我来说,最新的pip(1.5.6)可以正常使用不安全的nltk包,如果你只是告诉它不要那么挑剔安全性:
pip install --upgrade --force-reinstall --allow-all-external --allow-unverified ntlk nltk
答案 11 :(得分:3)
我遇到了同样的问题。我刚刚将python从 2.7.0 更新为 2.7.15 。它解决了这个问题。
您可以下载here。
答案 12 :(得分:3)
macOS Sierra 10.12.6。无法通过pip安装任何东西(通过自制软件安装python)。上面的所有答案都没有用。
最终,从python 3.5升级到3.6。
brew update
brew doctor #(in case you see such suggestion by brew)
然后按照brew的任何其他建议,即覆盖到python的链接。
答案 13 :(得分:2)
blackjar在上面发布的内容,以下几行对我有用
<ng-select
#changeowner
class="custom-owner"
[placeholder]="leagueOwner.full_name"
[clearSearchOnAdd]="true"
(change)="changeLeagueOwner($event)"
[clearable]="false"
[virtualScroll]="true"
[items]="adminLeagueMembers"
(scrollToEnd)="onAdminLoadScrollEnd()"
bindLabel="full_name">
</ng-select>
您需要全部输入三个pip --trusted-host pypi.python.org --trusted-host files.pythonhosted.org --trusted-host pypi.org install xxx
。在查看了答案之后,我只尝试了第一个,但是那样对我来说并不起作用。
答案 14 :(得分:2)
尝试
pip --trusted-host pypi.python.org --trusted-host files.pythonhosted.org --trusted-host pypi.org install xxx
最后解决了,不太了解为什么更改了pypi.python.org域。
答案 15 :(得分:2)
您也可以使用conda来安装软件包:请参阅http://conda.pydata.org
conda install nltk
使用conda的最佳方法是下载Miniconda,但您也可以尝试
pip install conda
conda init
conda install nltk
答案 16 :(得分:1)
只需卸载并重新安装将为您锻炼的pip软件包即可。
Mac os版本:较高的Sierra 10.13.6
python版本:3.7
因此,我通过输入以下命令卸载了较旧的pip并安装了最新版本10.0.0:
python3 -m pip uninstall pip setuptools
curl https://bootstrap.pypa.io/get-pip.py | python3
现在我的问题解决了。如果您使用的是python2,则可以将python3替换为python。我希望它也对您有用。
答案 17 :(得分:1)
我在Windows 7上执行了以下操作来解决此问题。
c:\ Program Files \ Python36 \ Scripts&gt; pip install beautifulsoup4 --trusted-host *
--trusted-host似乎解决了SSL问题,*表示每个主机。
当然这不起作用,因为你得到其他错误,因为没有满足要求beautifulsoup4的版本,但我不认为这个问题与一般问题有关。
答案 18 :(得分:1)
如果您通过代理进行连接,请执行export https_proxy=<your_proxy>
(在Unix或Git Bash上),然后重试安装。
如果您使用的是Windows cmd,则会更改为set https_proxy=<your_proxy>
。
答案 19 :(得分:1)
我尝试了一些流行的答案,但是仍然无法使用pip install
安装任何库/软件包。
我的具体错误是'SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain
使用Windows版Miniconda(安装程序Miniconda3-py37_4.8.3-Windows-x86.exe)。
当我这样做时,它终于可以工作了:
pip install -r requirements.txt --trusted-host pypi.org --trusted-host pypi.python.org --trusted-host files.pythonhosted.org
具体来说,我添加了此内容以使其正常工作:--trusted-host pypi.org --trusted-host pypi.python.org --trusted-host files.pythonhosted.org
答案 20 :(得分:0)
我通过在Mac上更新Python3 Virtualenv解决了此问题。
我引用了网站https://gist.github.com/pandafulmanda/730a9355e088a9970b18275cb9eadef3
brew install python3
pip3 install virtualenv
答案 21 :(得分:0)
尝试安装 xcode,然后使用 Homebrew 使用“brew install pipenv”安装 pipenv。
答案 22 :(得分:0)
This video tutorial为我工作:
$ curl https://bootstrap.pypa.io/get-pip.py | python
答案 23 :(得分:0)
我用PyCharm进行了这个操作,将pip升级到10.0.1打破了&#34;&#39; main&#39;没有在模块中找到&#34;错误。
我可以通过安装pip 9.0.3来解决这个问题,就像在其他一些线程中看到的那样。这些是我做的步骤:
之后一切都开始起作用了。
答案 24 :(得分:0)
在mac上使用最新版本的python Python 2.7.15rc1 https://bugs.python.org/issue17128
答案 25 :(得分:0)
我通过以下步骤解决了这个问题(在sles 11sp2上)
zypper remove pip
easy_install pip=1.2.1
pip install --upgrade scons
以下是puppet中的相同步骤(适用于所有发行版)
package { 'python-pip':
ensure => absent,
}
exec { 'python-pip':
command => '/usr/bin/easy_install pip==1.2.1',
require => Package['python-pip'],
}
package { 'scons':
ensure => latest,
provider => pip,
require => Exec['python-pip'],
}
答案 26 :(得分:0)
如果它只是nltk,我曾经遇到过类似的问题。请尝试以下安装指南。 Install NLTK
如果您确定它不能与任何其他模块一起使用,则可能会遇到安装不同版本Python的问题。
或尝试看看是否已经安装了pip。:
sudo apt-get install python-pip python-dev build-essential
看看它是否有效。