我安装了Pip3,但我无法使用pip3.2,这似乎干扰了我通过pip3安装的一些软件包。
$ pip3 install pymysql
$ pip3 list | grep PyMySQL
PyMySQL (0.7.11)
$ python3
Python 3.2.3 (default, Mar 25 2017, 08:49:29)
[GCC 4.7.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import pymysql
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named pymysql
注意到python3默认为python 3.2.3我查看了pip3.2:
$ pip3.2 list | grep PyMySQL
Traceback (most recent call last):
File "/usr/local/bin/pip3.2", line 7, in <module>
from pip import main
File "/usr/local/lib/python3.2/dist-packages/pip/__init__.py", line 21, in <module>
from pip._vendor.requests.packages.urllib3.exceptions import DependencyWarning
File "/usr/local/lib/python3.2/dist-packages/pip/_vendor/requests/__init__.py", line 66, in <module>
from .models import Request, Response, PreparedRequest
File "/usr/local/lib/python3.2/dist-packages/pip/_vendor/requests/models.py", line 856
http_error_msg = u'%s Client Error: %s for url: %s' % (self.status_code, reason, self.url)
^
SyntaxError: invalid syntax
我不知道pip3最初是如何安装的,但我想卸载然后使用How to install pip with Python 3?重新安装。
更新
我已经运行$ pip uninstall pip
但pip3仍然安装在系统上。
然后我跑了$ sudo apt-get remove python-pip
&amp; $ sudo apt-get remove python3-pip
但它仍然安装。
删除pip3的最佳方式是什么?
答案 0 :(得分:0)
为避免这种冲突,
首先使用此命令
卸载当前的pip包pip uninstall pip
然后尝试使用
再次使用python3安装pipsudo apt-get install python3-pip
它应该有用。