本文介绍了安装虚拟环境 Python 3.5 Linux Mint 17 的错误信息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Linux Mint 17 和 Python 3.5.1

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 中,但没有成功.

I have tried various ways to get the terminal to show I am in a venv with no success.

推荐答案

这是由于 Ubuntu 14.04(Linux Mint 17 所基于的)中的一个错误

That's due to a bug in Ubuntu 14.04 (on which Linux Mint 17 is based)

您可以在没有pip的情况下创建虚拟环境,然后手动将其安装到环境中:

You can either create the virtual environment without pip and then manually install it inside the environment:

$ python3 -m venv --without-pip my_venv
$ source my_venv/bin/activate
(my_venv)$ curl https://bootstrap.pypa.io/get-pip.py | python

或者您可以通过调整这些在您的系统中手动安装ensurepip对 Python 3.5.1 的说明:

Or you can manually install ensurepip in your system, by adapting these instructions to Python 3.5.1:

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-

这篇关于安装虚拟环境 Python 3.5 Linux Mint 17 的错误信息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-30 04:07