Ubuntu14.04上安装pip的方法
2016-10-27 15:12
337 查看
Ubuntu14.04上安装pip的方法
在Ubuntu14.04上,建议通过下面的方法安装,这是一种通用的方法,也适用于Windows,当然在Windows下手动下载下来就行了
wget https://bootstrap.pypa.io/get-pip.py --no-check-certificate sudo python get-pip.py
如果在Ubuntu14.04上你用sudo apt-get install python-pip下载安装,在使用时有可能出现下面的问题
root@ubt:~# pip Traceback (most recent call last): File "/usr/bin/pip", line 9, in <module> load_entry_point('pip==1.5.4', 'console_scripts', 'pip')() File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 351, in load_entry_point return get_distribution(dist).load_entry_point(group, name) File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2363, in load_entry_point return ep.load() File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2088, in load entry = __import__(self.module_name, globals(),globals(), ['__name__']) File "/usr/lib/python2.7/dist-packages/pip/__init__.py", line 11, in <module> from pip.vcs import git, mercurial, subversion, bazaar # noqa File "/usr/lib/python2.7/dist-packages/pip/vcs/mercurial.py", line 9, in <module> from pip.download import path_to_url File "/usr/lib/python2.7/dist-packages/pip/download.py", line 25, in <module> from requests.compat import IncompleteRead ImportError: cannot import name IncompleteRead
这是因为通过apt-get安装的pip版本太老了,老的pip版本依赖requests.compat.IncompleteRead,而在2.4.0版本的requests中已经移除了
requests.compat.IncompleteRead,解决方法是先卸载pip(命令为sudo apt-get remove python-pip),然后再用上面的方法重新安装。
有时,还会遇到下面的SSL错误
/tmp/tmpFlFxFp/pip.zip/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.org/en/latest/security.html#snimissingwarning. /tmp/tmpFlFxFp/pip.zip/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.org/en/latest/security.html#insecureplatformwarning.[/code]
安装下面几个包pip install pyopenssl ndg-httpsclient pyasn1
如果还有问题,再安装下面的包sudo apt-get install libffi-dev libssl-dev
安装完后,测试一下吧,发现不能识别pip这个命令,额,我也不知道怎么回事,解决办法是在/usr/bin目录下建一个软链接,指向到/usr/local/bin/pipnjsqrt3@temp-test2:~$ pip -bash: /usr/bin/pip: No such file or directory # $PATH的值包含/usr/bin njsqrt3@temp-test2:~$ which pip /usr/local/bin/pip # $PATH的值包含/usr/local/bin njsqrt3@temp-test2:~$ njsqrt3@temp-test2:~$ echo $PATH /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games njsqrt3@temp-test2:~$
相关文章推荐
- Ubuntu14.04上安装pip的方法
- Ubuntu14.04上安装pip的方法
- Ubuntu14.04上安装pip、sublime的方法
- Ubuntu14.04 下安装pip和virtualenv的方法
- Ubuntu 14.04 U盘安装方法——最简易的双系统安装方法
- ubuntu怎么安装mac os x?ubuntu14.04安装mac os x主题方法
- Ubuntu 14.04~14.10 Linux 3D桌面完全教程,显卡驱动安装方法,compiz特效介绍,常见问题解答
- ubuntu下python2.7 安装 xlrd、xlwt、pip、 第三方库(library)的简易方法、pip 安装 selenium
- Ubuntu 14.04 Linux 3D桌面完全教程,显卡驱动安装方法,compiz特效介绍,常见问题解答
- 在ubuntu14.04上安装oracle java6 java7的方法
- 解决ubuntu amd64 14.04 bash./ 没有那个文件或目录 的方法(含ia32-libs包的安装方法)
- 安装ubuntu14.04之后无法在右上角打开system settings的解决方法
- Ubuntu14.04安装wineqq国际版出现无法输入中文的解决方法
- VirtualBox 4.3.12安装ubuntu 14.04 分辨率过小问题的解决方法
- ubuntu 14.04 下 安装samba 及SSH 服务端的方法
- u盘安装ubuntu 14.04 lts方法步骤
- Vmware 8.0安装Ubuntu14.04后没有图形界面的解决方法:VMware Tools is currently being installed on your system.
- Ubuntu14.04无法安装ia32-libs解决方法
- 安装ubuntu14.04后无线网卡无法使用的解决方法
- ubuntu14.04安装方法汇总