|
10 years ago 6 |
You've finally decided to start playing around with Python 3 and decide to use the python3.4
that comes with Mint 17 Qiana. Wanting to put your code in a virtual environment, you type the command and get:
$ pyvenv-3.4 hello_world
Error: Command '['/home/andy/python/hello_world/bin/python3.4', '-Im', 'ensurepip', '--upgrade', '--default-pip']' returned non-zero exit status 1
Well, that's not good! Basically, this problem exists because the ensurepip module, which is a standard Python module (in Python 3.4, at least) is mysteriously missing. Yes, there's lots of discussion on the Ubuntu (and Debian) bug tracking sites - mostly about which package it should go in. But, luckily, the fix is easy!
This problem exists in Debian, Ubuntu 14.04/14.04.1 LTS, Mint 17 Qiana plus any derivatives of those. The simple solution works for all these as well. Plus, since ensurepip is a Python module written in Python, the fix is the same no matter what architecture you are running.
Just execute the following commands:
cd /usr/lib/python3.4
sudo mkdir -p ensurepip/_bundled
cd ensurepip
sudo wget https://github.com/akheron/cpython/raw/v3.4.0/Lib/ensurepip/__init__.py
sudo wget https://github.com/akheron/cpython/raw/v3.4.0/Lib/ensurepip/__main__.py
sudo wget https://github.com/akheron/cpython/raw/v3.4.0/Lib/ensurepip/_uninstall.py
cd _bundled
sudo wget https://github.com/akheron/cpython/raw/v3.4.0/Lib/ensurepip/_bundled/pip-1.5.4-py2.py3-none-any.whl
sudo wget https://github.com/akheron/cpython/raw/v3.4.0/Lib/ensurepip/_bundled/setuptools-2.1-py2.py3-none-any.whl
Then re-run the pyvenv-3.4
command again:
$ pyvenv-3.4 hello_world
Tada! Have fun and enjoy!