今天有一个朋友说在Ubuntu虚拟机上安装python-pip很困难,我想想以后我也要python的爬虫或者别的,也一定要装pip,赶紧我也试试。
#sudo lsb_release -a
Distributor ID: Ubuntu
Description: Ubuntu 14.04.5 LTS
说明了我现在ubuntu的版本,再来看一下pip有没有。
#pip -V
The program 'pip' is currently not installed. You can install it by typing:
sudo apt-get install python-pip
看来是没有需要安装。试着安装一下,看看是否成功。
#apt-get install python-pip
Reading package lists... Done
Building dependency tree
Reading state information... Done
python-pip is already the newest version.
The following package was automatically installed and is no longer required:
libqpdf13
Use 'apt-get autoremove' to remove it.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
#pip -V
pip 1.5.4 from /usr/lib/python2.7/dist-packages (python 2.7)
这个应该是有点问题,我的ubuntu上是有两个版本的Python,一个2.7,一个3.4。这个应该说明我安装的是适合python2.7版的。
#pip3 install --upgrade pip
pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
Could not fetch URL https://pypi.python.org/simple/pip/: There was a problem confirming the ssl certificate: Can't connect to HTTPS URL because the SSL module is not available. - skipping
Requirement already up-to-date: pip in /usr/local/lib/python3.6/site-packages
我到底安装了多少个版本的python呀?我到底干了些什么?
#python -V
显示: Python 2.7.6
python3 -V
显示:Python 3.6.0
#python3.4 -V
显示:Python 3.4.3
发现自己安装两个版本的python,一个3.4.3,一个3.6.0,自带一个2.7.6。这回算是明白点了。
#sd /usr/local/bin
#ls
to3 idle3.6 pydoc3.6 python3.6m pyvenv-3.6
2to3-3.6 pip3 python3 python3.6m-config
easy_install-3.6 pip3.6 python3.6 python3-config
idle3 pydoc3 python3.6-config pyvenv
#pip3 -V
pip 9.0.1 from /usr/local/lib/python3.6/site-packages (python 3.6)
#pip3.6 -V
pip 9.0.1 from /usr/local/lib/python3.6/site-packages (python 3.6)
看来都是3.6这个版本的,有可能是我之前安装python3.6的时候就已经安装过了。
安装新的python包:
#pip install packageName
卸载python包:
#pip uninstall packageName
寻找python包:
#pip search packageName
看一下pip3.6是否安装好了?
#pip3.6 list
DEPRECATION: The default format will switch to columns in the future. You can use --format=(legacy|columns) (or define a format=(legacy|columns) in your pip.conf under the [list] section) to disable this warning.
pip (9.0.1)
setuptools (28.8.0)
不行,我困了,先写到这里吧,还没有验证pip3.6是否安装正确,是否能正常使用,等待下一期吧。
网友评论