更新python后pip无法使用?

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/yanhe156/article/details/83628955
  • 更新python版本参考https://www.linuxidc.com/Linux/2017-12/149913.htm。

注意两点:

  1. apt-get需要先安装 sudo apt-get install libssl-dev

  2. 出现以下错误时

Traceback (most recent call last):
  File "/usr/bin/lsb_release", line 28, in <module>
    import lsb_release
ImportError: No module named lsb_release

是因为新安装的python的sys.path中没有找到lsb_release.py这个文件。

  • 解决方法:

1 执行python,输入

import sys
sys.path

查看sys.path具体是什么,sys.path是python要引入的包的路径。

2 使用sudo find / -name lsb_release.py 指令搜索lsb_release.py的位置,然后将其拷贝到sys.path目录下。

但是目前还有个问题,apt-get 安装的包还是安装到原来的path下。

猜你喜欢

转载自blog.csdn.net/yanhe156/article/details/83628955
今日推荐