-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpython-todo.txt
More file actions
36 lines (28 loc) · 2.25 KB
/
python-todo.txt
File metadata and controls
36 lines (28 loc) · 2.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
47
down vote
I would recommend pyenv to solve your woes. It doesn't use Aptitude, and does involve "building it yourself", but it's fully automated. You can build and install a new (or old) version of Python by simply saying pyenv install 3.6.0. Everything runs as your user, so you don't have to worry about messing up the Python used by Ubuntu itself.
Install pyenv
Install headers needed to build CPythons (exotic Pythons like PyPy or Jython may have other dependencies):
sudo apt-get install -y build-essential libbz2-dev libssl-dev libreadline-dev \
libsqlite3-dev tk-dev
# optional scientific package headers (for Numpy, Matplotlib, SciPy, etc.)
sudo apt-get install -y libpng-dev libfreetype6-dev
Run the installer script (installs pyenv and some very useful pyenv plugins by the original author; see here for more)
curl -L https://raw.githubusercontent.com/yyuu/pyenv-installer/master/bin/pyenv-installer | bash
Add init lines to your ~/.profile or ~/.bashrc (it mentions it at the end of the install script):
export PATH="~/.pyenv/bin:$PATH"
eval "$(pyenv init -)"
eval "$(pyenv virtualenv-init -)"
Restart your shell to reload the profile script. (with e.g. source ~/.bashrc)
Done!
Setting up an environment
To not touch the system Python (generally a bad idea; OS-level services might be relying on some specific library versions, etc.) make your own environment, it's easy! Even better, no sudo, for it or pip installs!
Install your preferred Python version (this will download the source and build it for your user, no input required)
pyenv install 3.6.0
Make it a virtualenv so you can make others later if you want
pyenv virtualenv 3.6.0 general
Make it globally active (for your user)
pyenv global general
Do what you want to with the Python/pip, etc. It's yours.
If you want to clean out your libraries later, you could delete the virtualenv (pyenv uninstall general) or make a new one (pyenv virtualenv 3.6.0 other_proj). You can also have environments active per-directory: pyenv local other_proj will drop a .python-version file into your current folder and any time you invoke Python or pip-installed Python utilities from it or under it, they will be shimmed by pyenv.
https://askubuntu.com/questions/865554/how-do-i-install-python-3-6-using-apt-get