pyenv
Mit Gebräu installieren
$ brew install pyenv
Bestätigung
$ pyenv --help
Usage: pyenv <command> [<args>]
Some useful pyenv commands are:
commands List all available pyenv commands
local Set or show the local application-specific Python version
global Set or show the global Python version
shell Set or show the shell-specific Python version
install Install a Python version using python-build
uninstall Uninstall a specific Python version
rehash Rehash pyenv shims (run this after installing executables)
version Show the current Python version and its origin
versions List all Python versions available to pyenv
which Display the full path to an executable
whence List all Python versions that contain the given executable
See `pyenv help <command>' for information on a specific command.
For full documentation, see: https://github.com/yyuu/pyenv#readme
$ brew info pyenv
pyenv: stable 20160509, HEAD
Python version management
https://github.com/yyuu/pyenv
/usr/local/Cellar/pyenv/20160509 (489 files, 2.1M) *
Built from source on 2016-06-02 at 10:49:26
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/pyenv.rb
==> Dependencies
Recommended: autoconf ✔, pkg-config ✔, openssl ✔, readline ✔
==> Options
--without-autoconf
Build without autoconf support
--without-openssl
Build without openssl support
--without-pkg-config
Build without pkg-config support
--without-readline
Build without readline support
--HEAD
Install HEAD version
==> Caveats
To use Homebrew's directories rather than ~/.pyenv add to your profile:
export PYENV_ROOT=/usr/local/var/pyenv
To enable shims and autocompletion add to your profile:
if which pyenv > /dev/null; then eval "$(pyenv init -)"; fi
Durchgehen.
echo 'export PYENV_ROOT=/usr/local/var/pyenv' >> ~/.bash_profile
echo 'eval "$(pyenv init -)"' >> ~/.bash_profile
source ~/.bash_profile
python
Überprüfen Sie die installierbare Version
$ pyenv install --list
Installation
$ pyenv install 3.5.1
Downloading Python-3.5.1.tgz...
-> https://www.python.org/ftp/python/3.5.1/Python-3.5.1.tgz
Installing Python-3.5.1...
BUILD FAILED (OS X 10.11.5 using python-build 20151028)
Inspect or clean up the working tree at /var/folders/pq/m1yrrt652vg03wf5q66xk0m00000gn/T/python-build.20160529161005.9447
Results logged to /var/folders/pq/m1yrrt652vg03wf5q66xk0m00000gn/T/python-build.20160529161005.9447.log
Last 10 log lines:
File "/private/var/folders/pq/m1yrrt652vg03wf5q66xk0m00000gn/T/python-build.20160529161005.9447/Python-3.5.1/Lib/ensurepip/__main__.py", line 4, in <module>
ensurepip._main()
File "/private/var/folders/pq/m1yrrt652vg03wf5q66xk0m00000gn/T/python-build.20160529161005.9447/Python-3.5.1/Lib/ensurepip/__init__.py", line 209, in _main
default_pip=args.default_pip,
File "/private/var/folders/pq/m1yrrt652vg03wf5q66xk0m00000gn/T/python-build.20160529161005.9447/Python-3.5.1/Lib/ensurepip/__init__.py", line 116, in bootstrap
_run_pip(args + [p[0] for p in _PROJECTS], additional_paths)
File "/private/var/folders/pq/m1yrrt652vg03wf5q66xk0m00000gn/T/python-build.20160529161005.9447/Python-3.5.1/Lib/ensurepip/__init__.py", line 40, in _run_pip
import pip
zipimport.ZipImportError: can't decompress data; zlib not available
make: *** [install] Error 1
Oh. Ich wurde gescholten. .. ..
Es scheint, dass Sie wütend werden, wenn das xcode-Befehlszeilentool nicht enthalten ist. Installieren Sie es also.
$ xcode-select --install
Die Installation wird von der GUI bestätigt, also was ist gut ...
Erneut ausführen
$ pyenv install 3.5.1
Downloading Python-3.5.1.tgz...
-> https://www.python.org/ftp/python/3.5.1/Python-3.5.1.tgz
Installing Python-3.5.1...
Installed Python-3.5.1 to /Users/LowSE01/.pyenv/versions/3.5.1
Diesmal ist es OK.
Geben Sie die standardmäßig zu verwendende Version an
$ pyenv global 3.5.1
Bestätigung
$ python --version
Python 3.5.1
OK, wenn Version installiert ist.
anaconda
Installation ausführen
$ pyenv install anaconda3-4.0.0
Geben Sie die standardmäßig zu verwendende Version an
$ pyenv global anaconda3-4.0.0
IntelliJ + Python
Recommended Posts