在ubuntu 16.04上安装distutils项目的python 3.6 pip安装失败

时间:2018-05-25 19:47:28

标签: ubuntu-16.04 python-3.6 distutils pycurl

我正在运行ubuntu 16.04并且有一些使用python 3.6功能的python代码。我已经能够使用python3.6和pip3.6安装一些库(scipy)。但是有一些库(pycurl)使用pip install不起作用:

$sudo python3.6 -m pip  install pycurl
Requirement already satisfied: pycurl in /usr/lib/python3/dist-packages (7.43.0)

这不允许我在python3.6环境中导入pycurl。 如果我改为使用升级,我会收到有关pycurl是distutils安装包的错误。

如何为我的python3.6安装访问pycurl?

$ sudo python3.6 -m pip  install --upgrade pycurl
The directory '/home/riaps/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/home/riaps/.cache/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Collecting pycurl
  Downloading https://files.pythonhosted.org/packages/77/d9/d272b38e6e25d2686e22f6058820298dadead69340b1c57ff84c87ef81f0/pycurl-7.43.0.1.tar.gz (195kB)
    100% |████████████████████████████████| 204kB 2.8MB/s 
Installing collected packages: pycurl
  Found existing installation: pycurl 7.43.0
Cannot uninstall 'pycurl'. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall.

1 个答案:

答案 0 :(得分:0)

所以问题似乎是它安装在/usr/lib/python3/dist-packages中。通过运行sudo pip3 install --upgrade pycurl它已移至:/usr/local/lib/python3.5/dist-packages,然后sudo python3.6 -m pip install pycurl可以安装。

我不知道为什么这是一个问题,但它解决了这个问题。