Linux Mint 17 with Python 3.5.1
$ python3 -m venv ENV_DIR
返回:
错误:命令
'['/home/path/to/ENV_DIR/bin/python3', '-Im', 'ensurepip', '--upgrade', '--default-pip']'
返回非零退出状态 1
我已经尝试了各种方法让终端显示我处于 venv 中,但没有成功。
这是
由于Ubuntu 14.04(Linux Mint 17基于该错误)中的一个错误。
您可以在不pip
的情况下创建虚拟环境,然后将其手动安装在环境中:
$ python3 -m venv --without-pip my_venv
$ source my_venv/bin/activate
(my_venv)$ curl https://bootstrap.pypa.io/get-pip.py | python
或者,您可以通过将这些指令调整到 Python 3.5.1 中,在系统中手动安装 ensurepip
:
cd /usr/lib/python3.5
sudo mkdir -p ensurepip/_bundled
cd ensurepip
sudo wget https://github.com/akheron/cpython/raw/v3.5.1/Lib/ensurepip/__init__.py
sudo wget https://github.com/akheron/cpython/raw/v3.5.1/Lib/ensurepip/__main__.py
sudo wget https://github.com/akheron/cpython/raw/v3.5.1/Lib/ensurepip/_uninstall.py
cd _bundled
sudo wget https://github.com/akheron/cpython/raw/v3.5.1/Lib/ensurepip/_bundled/pip-1.5.4-py2.py3-none-any.whl
sudo wget https://github.com/akheron/cpython/raw/v3.5.1/Lib/ensurepip/_bundled/setuptools-