Install python3.* under Mac (latest version)

Source: Internet
Author: User
Tags sqlite

Introduction: The Mac system comes with Python, but with the latest version of the current MAC system, for example, the Python version comes with the 2.* version, although it does not affect the operation of the old version of the project, but some syntax of the latest 3.* version of Python is not the same as the 2.* version, Online tutorial The great gods are certainly updated with the latest version of the tutorial, whether we study or use, of course, with the latest version will be a little better.

Reprint please specify the source http://www.cnblogs.com/meng1314-shuai/p/9031686.html

1, before installing the latest version of python3.*, we first familiar with the system comes with Python.

The Mac system comes with a python path of/System/Library/Frameworks/Python.framework/Version,我们先来打开目录看一下:

Open/system/library/frameworks/python.framework/versions

We see that there are multiple versions of Python here, and the current directory is the Python version of the system.

Now that the Mac comes with Python, it certainly configures the Python Global command, which we run directly at the terminal:

Python

is operating normally. It's pretty much about Python from the Mac system, and then we'll start installing the latest version of Python.

2, start the installation (here we use artifact homebrew, not familiar with the artifact's small partners please Baidu, you can also click the link directly to download)

Before installing, search for a package that already exists Python3:

Brew Search Python3

Already exists, we can install it directly:

Brew Install Python3

==> auto-updated homebrew!

Updated 1 Tap (Homebrew/core).

==> Updated formulae

Angular-cli fluent-bit links [email protected] texmath

BYACC fn mlt qcachegrind tile38

Caddy Ipython osrm-backend Rhino wtf

Cfitsio [email protected] PostgreSQL siril

Cfssl LIBPQ [email protected] sundials

Dnscrypt-proxy libpqxx [email protected] synfig

==> Installing dependencies for Python: sphinx-doc, gdbm , OpenSSL, sqlite, XZ

==> Installing python dependency: sphinx-doc

==> downloading Https://homebrew.bintray.com/bottles/sphinx-doc-1.7.4.high_sierr

######################################################################## 100%

==> pouring sphinx-doc-1.7.4.high_sierra.bottle.tar.gz

==> Caveats

This formula is keg-only, which means it wasn't symlinked into/usr/local,

Because this formula was mainly used internally by other formulae.

Users is advised to the use of ' pip ' to install Sphinx-doc.

If you need to the software first in your PATH run:

echo ' Export path= '/usr/local/opt/sphinx-doc/bin: $PATH ' >> ~/.bash_profile

==> Summary

?? /usr/local/cellar/sphinx-doc/1.7.4:2,642 files, 36.8MB

==> Installing python dependency: gdbm

==> downloading https://homebrew.bintray.com/bottles/gdbm-1.14.1_1.high_sierra.b

######################################################################## 100%

==> pouring gdbm-1.14.1_1.high_sierra.bottle.tar.gz

?? /usr/local/cellar/gdbm/1.14.1_1:20 files, 555.7KB

==> Installing python dependency: OpenSSL

==> downloading Https://homebrew.bintray.com/bottles/openssl-1.0.2o_1.high_sierr

######################################################################## 100%

==> pouring openssl-1.0.2o_1.high_sierra.bottle.tar.gz

==> Caveats

A CA file has been bootstrapped using certificates from the Systemroots

Keychain. To add additional certificates (e.g. the certificates added in

The System keychain), place. Pem files in

/usr/local/etc/openssl/certs

and run

/usr/local/opt/openssl/bin/c_rehash

This formula is keg-only, which means it wasn't symlinked into/usr/local,

Because Apple have deprecated use of the OpenSSL in favor of its own TLS and crypto libraries.

If you need to the software first in your PATH run:

echo ' Export path= '/usr/local/opt/openssl/bin: $PATH ' >> ~/.bash_profile

For compilers-to-find this software-need to set:

Ldflags: -l/usr/local/opt/openssl/lib

Cppflags:-i/usr/local/opt/openssl/include

For Pkg-config-to-find this software-need to set:

Pkg_config_path:/usr/local/opt/openssl/lib/pkgconfig

==> Summary

?? /usr/local/cellar/openssl/1.0.2o_1:1,791 files, 12.3MB

==> Installing python dependency: sqlite

==> downloading https://homebrew.bintray.com/bottles/sqlite-3.23.1.high_sierra.b

######################################################################## 100%

==> pouring sqlite-3.23.1.high_sierra.bottle.tar.gz

==> Caveats

This formula is keg-only, which means it wasn't symlinked into/usr/local,

Because MacOS provides an older sqlite3.

If you need to the software first in your PATH run:

echo ' Export path= '/usr/local/opt/sqlite/bin: $PATH ' >> ~/.bash_profile

For compilers-to-find this software-need to set:

Ldflags: -l/usr/local/opt/sqlite/lib

Cppflags:-i/usr/local/opt/sqlite/include

For Pkg-config-to-find this software-need to set:

Pkg_config_path:/usr/local/opt/sqlite/lib/pkgconfig

==> Summary

?? /usr/local/cellar/sqlite/3.23.1:11 files, 3MB

==> Installing python dependency: xz

==> downloading Https://homebrew.bintray.com/bottles/xz-5.2.4.high_sierra.bottle

######################################################################## 100%

==> pouring xz-5.2.4.high_sierra.bottle.tar.gz

?? /usr/local/cellar/xz/5.2.4:92 files, 1MB

==> Installing python

Warning: Building python from Source:

The bottle needs the Apple Command line Tools to be installed.

You can install the them, if desired, with:

Xcode-select--install

==> downloading https://www.python.org/ftp/python/3.6.5/Python-3.6.5.tar.xz

######################################################################## 100%

==> ./configure--prefix=/usr/local/cellar/python/3.6.5--enable-ipv6--dataroot

==> make

==> make install pythonappsdir=/usr/local/cellar/python/3.6.5

==> make frameworkinstallextras Pythonappsdir=/usr/local/cellar/python/3.6.5/sha

==> downloading Https://files.pythonhosted.org/packages/72/c2/c09362ab29338413ab

######################################################################## 100%

==> downloading https://files.pythonhosted.org/packages/ae/e8/2340d46ecadb1692a1

######################################################################## 100%

==> downloading https://files.pythonhosted.org/packages/5d/c1/45947333669b31bc6b

######################################################################## 100%

==> make html

Error: An unexpected error occurred during the ' Brew link ' step

The formula built, but was not symlinked into/usr/local

Permission denied @ dir_s_mkdir-/usr/local/frameworks

Error: Permission denied @ dir_s_mkdir-/usr/local/frameworks

All the packages were downloaded, but we found that the last two errors were reported, presumably meaning that the formula was established, but an unexpected error occurred when creating the connection because there was no permission. In the error message we see a directory/usr/local/frameworks, let's go first to find this directory:

Open/usr/local/frameworks

Find that this directory does not even exist, then we will create one manually:

sudo mkdir/usr/local/frameworks

After you create the directory, you can resolve the permissions issue:

sudo chown $ (whoami): Admin/usr/local/frameworks

No error is the modification of the success, after modifying the permissions, you also need to manually perform the installation is not completed the creation of the connection:

Brew Link Python3

The connection was successful. Let's take a look at the Python3 information in the current system:

Brew Info Python3

Python3 was found to be installed in the/usr/local/bin/python3 directory, and interested partners went to see the configuration file themselves.

The installation of Python3 here is complete, but there may be small partners who have found that the default Python version is the 2.* version of the system, whether the terminal is running PYTHON-V viewing the version number or running the Python command-line mode directly. In fact, this time only to run the command to change Python to Python3 on the line, of course, interested partners can also try to configure the default version, the default version of the current system to modify the 3.* version. It has been posted a variety of methods, I do not do more to repeat here.

Reprint please specify the source http://www.cnblogs.com/meng1314-shuai/p/9031686.html

Install python3.* under Mac (latest version)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.