适用于Linux的Anaconda 3不能确保吗? [英] Anaconda 3 for Linux Has No ensurepip?
问题描述
这是我的环境:
-
CentOS 64位7.2.1511
CentOS 64-bit 7.2.1511
Anaconda 3 4.1.1 64位(Python 3.5.2)
Anaconda 3 4.1.1 64-bit (Python 3.5.2)
我想通过pyvenv
创建venv虚拟环境.不幸的是,我收到此错误消息:
I want to create venv virtual environment by pyvenv
. Unfortunately, I got this error message:
$ pyvenv test
Error: Command '['/root/test/bin/python', '-Im', 'ensurepip', '--upgrade', '--default-pip']' returned non-zero exit status 1
$ pyvenv test
Error: Command '['/root/test/bin/python', '-Im', 'ensurepip', '--upgrade', '--default-pip']' returned non-zero exit status 1
搜索Internet后,人们说模块ensurepip
丢失了.我检查了Anaconda安装路径/opt/anaconda3/lib/python3.5
.没有surepip文件夹.
After searching the Internet, people said the module ensurepip
is missing. I checked my Anaconda installation path /opt/anaconda3/lib/python3.5
. There is no ensurepip folder.
然后,在64位Windows 10上,我检查了Anaconda安装路径D:\win10\Anaconda3\Lib\
.有一个surepip文件夹!而且我可以成功运行python -m venv test
创建venv.
Then, on my Windows 10 64-bit, I checked my Anaconda installation path D:\win10\Anaconda3\Lib\
. There is an ensurepip folder! And I can successfully run python -m venv test
to create a venv.
然后,我检查了Anaconda python档案的下载:
Windows 10上的D:\win10\Anaconda3\pkgs\python-3.5.2-0.tar.bz2
和
/opt/anaconda3/pkgs/python-3.5.2-0.tar.bz2
在CentOS 7上.
Then, I checked the download Anaconda python archives:
D:\win10\Anaconda3\pkgs\python-3.5.2-0.tar.bz2
on Windows 10
and
/opt/anaconda3/pkgs/python-3.5.2-0.tar.bz2
on CentOS 7.
Windows 10上的一个档案确实有一个surepip子文件夹.但是CentOS 7上的那个却没有!
The one archive on Windows 10 does has a ensurepip subfolder. But the one on CentOS 7 doesn't!
有人知道这种区别吗?这是Anaconda的错误吗?
Does anyone know this difference? Is it a bug of Anaconda?
推荐答案
是的,Linux和Mac OS上的Anaconda3/2没有安装ensurepip
.
Yes, Anaconda3/2 for Linux and Mac OS do not have ensurepip
installed.
根据此问题记录,这不是错误,这是当Anaconda中的Python在没有--with-ensurepip=install
标志的情况下进行编译时,故意 完成了.
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.
我认为(Continuum Analytics)的理由是,在Anaconda Distribution 中,conda
是负责管理软件包和虚拟环境的老板,并且
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(及其setuptools依赖项)独立于Python 作为conda软件包安装.
因此,您可以先运行pyvenv test --without-pip
,然后再从
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.
就像下面这样:
$ #===== 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) $
这篇关于适用于Linux的Anaconda 3不能确保吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!