如何通过pip3安装软件包来解决问题?

时间:2018-11-14 08:25:01

标签: python pip

程序正常运行,然后当我尝试安装IMAPClient模块时出现错误:

sudo pip3 install IMAPClient

File "/usr/local/lib/python3.6/dist-packages/run/__init__.py", line 
145, in __new__
process = cls.create_process(command, stdin, cwd=cwd, env=env, shell=shell)       
File "/usr/local/lib/python3.6/dist-packages/run/__init__.py", line 
  121, in create_process
  shlex.split(command),
File "/usr/lib/python3.6/shlex.py", line 305, in split
  return list(lex)
File "/usr/lib/python3.6/shlex.py", line 295, in __next__
  token = self.get_token()
File "/usr/lib/python3.6/shlex.py", line 105, in get_token
  raw = self.read_token()
File "/usr/lib/python3.6/shlex.py", line 136, in read_token
  **strong text**nextchar = self.instream.read(1)
AttributeError: 'tuple' object has no attribute 'read'

我尝试重新安装pip,我还认为某些已安装的软件包存在问题,如果我尝试显示软件包列表,则会得到:

pip3 list
Package                  Version  
------------------------ ---------
apt-clone                0.2.1    
apturl                   0.5.2    
asn1crypto               0.24.0   
bcrypt                   3.1.4 
(some more packages).........

真的很期待建议,在询问之前会诚实地搜索论坛。

1 个答案:

答案 0 :(得分:0)

也许这是一个愚蠢的解决方案,但是它起作用了,我最终使用了命令:

1)sudo apt-get purge python3-pip
2)deleted the pip folder in the "/usr/lib/python3/dist-packages/pip" directory

因为该文件夹始终存在,并且如果我重新安装了pip软件包,则没有效果

3) sudo easy_install pip

结果,尽管需要更新版本,我的点子仍然可以赚取,并且我能够安装该软件包。

$ pip3 -V

pip 9.0.1 from /usr/lib/python3/dist-packages (python 3.6)

但故障原因尚未确定。感谢所有花时间解决这个问题的人