Anaconda 3 for Linux Has No ensurepip?

蹲街弑〆低调 提交于 2019-12-03 06:34:29

Yes, Anaconda3/2 for Linux and Mac OS do not have ensurepip installed.

According to this issue record, it is NOT a bug, this is done intentionally when the Python in Anaconda being compiled without the --with-ensurepip=install flag.

I think the rationale (of Continuum Analytics) is that, in Anaconda Distribution, conda is the boss to manage the packages and virtual environments, and

pip (and it's setuptools dependency) are installed independent of Python as conda packages.

So instead of running pyvenv test, you can first run pyvenv test --without-pip, then download the get-pip.py from pip's homepage, and install the pip in activated test venv.

Just like the following:

$ #===== First create the venv without pip, and **activate** it.
$ pyvenv test --without-pip
$ cd test/
$ ls bin/
activate       activate.csh   activate.fish  python@        python3@
$ echo $PATH
Whatever/Else:In/Your/System
$ source bin/activate
(test) $ echo $PATH
/Users/YaOzI/test/bin:Whatever/Else:In/Your/System
(test) $
(test) $ #===== Then install the pip independently.
(test) $ python ~/Downloads/get-pip.py
Collecting pip
  Using cached pip-8.1.2-py2.py3-none-any.whl
Collecting setuptools
  Downloading setuptools-26.0.0-py2.py3-none-any.whl (459kB)
    100% |████████████████████████████████| 460kB 1.3MB/s 
Collecting wheel
  Downloading wheel-0.29.0-py2.py3-none-any.whl (66kB)
    100% |████████████████████████████████| 71kB 5.7MB/s 
Installing collected packages: pip, setuptools, wheel
Successfully installed pip-8.1.2 setuptools-26.0.0 wheel-0.29.0
(test) $ ls bin/
activate   activate.fish     easy_install-3.5*  pip3*  python@   wheel*
activate.csh  easy_install*  pip*     pip3.5*   python3@
(test) $
(test) $ #===== Now you can play around with pip
(test) $ pip list
(test) $ 
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!