日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問(wèn) 生活随笔!

生活随笔

當(dāng)前位置: 首頁(yè) > 编程语言 > python >内容正文

python

电脑下载的python在哪里_mac下 python3 安装--有说明原电脑安装的文件在哪里

發(fā)布時(shí)間:2025/4/5 python 33 豆豆
生活随笔 收集整理的這篇文章主要介紹了 电脑下载的python在哪里_mac下 python3 安装--有说明原电脑安装的文件在哪里 小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

前言:mac系統(tǒng)自帶python,不過(guò)以當(dāng)前mac系統(tǒng)的最新版本為例,自帶的python版本都是2.*版本,雖然不影響老版本項(xiàng)目的運(yùn)行,但是python最新的3.*版本的一些語(yǔ)法與2.*版本并不相同,網(wǎng)上的教程大神們也肯定都更新出了最新版的教程,我們不論是學(xué)習(xí)還是使用,當(dāng)然用最新版會(huì)更好一點(diǎn)。

1、在安裝最新版Python3.*之前,我們先熟悉一下系統(tǒng)自帶的python。

Mac系統(tǒng)自帶python路徑為/System/Library/Frameworks/Python.framework/Version,我們先來(lái)打開(kāi)目錄看一下:

open /System/Library/Frameworks/Python.framework/Versions

我們看到這里有多個(gè)python版本,而在Current目錄下存放的是系統(tǒng)當(dāng)前的python版本。

mac既然自帶了python,當(dāng)然肯定配置好了python的全局命令,我們直接在終端運(yùn)行:

python

運(yùn)行正常。到這里也差不多對(duì)mac系統(tǒng)自帶的python有所了解,接下來(lái)我們開(kāi)始安裝最新版本的python。

2、開(kāi)始安裝(這里我們使用神器homebrew,還不熟悉此神器的小伙伴請(qǐng)自行百度,也可點(diǎn)擊鏈接直接前往下載)

安裝前先搜索一下是否已經(jīng)存在python3的包:

brew search python3

已經(jīng)存在,我們可以直接安裝了:

brew install python3

==>Auto-updated Homebrew!

Updated 1 tap (homebrew/core).

==>Updated Formulae

angular-cli fluent-bitlinks postgresql@9.6texmath

byacc fnmlt qcachegrind tile38

caddy ipython osrm-backendrhino wtf

cfitsio ipython@5 postgresqlsiril

cfssl libpq postgresql@9.4sundials

dnscrypt-proxylibpqxx postgresql@9.5synfig

==>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.0%

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

==>Caveats

This formula is keg-only, which means it was not symlinked into /usr/local,

because this formula is mainly used internally by other formulae.

Users are advised to use `pip` to install sphinx-doc.

If you need to have this 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.0%

==>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.0%

==>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 was not symlinked into /usr/local,

because Apple has deprecated use of OpenSSL in favor of its own TLS and crypto libraries.

If you need to have this software first in your PATH run:

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

For compilers to find this software you may need to set:

LDFLAGS:-L/usr/local/opt/openssl/lib

CPPFLAGS: -I/usr/local/opt/openssl/include

For pkg-config to find this software you may 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.0%

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

==>Caveats

This formula is keg-only, which means it was not symlinked into /usr/local,

because macOS provides an older sqlite3.

If you need to have this software first in your PATH run:

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

For compilers to find this software you may need to set:

LDFLAGS:-L/usr/local/opt/sqlite/lib

CPPFLAGS: -I/usr/local/opt/sqlite/include

For pkg-config to find this software you may 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.0%

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

🍺/usr/local/Cellar/xz/5.2.4: 92 files, 1MB

==>Installingpython

Warning:Building python from source:

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

You can install them, if desired, with:

xcode-select --install

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

######################################################################## 100.0%

==>./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.0%

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

######################################################################## 100.0%

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

######################################################################## 100.0%

==>make html

Error:An unexpected error occurred during the `brew link` step

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

Permission denied @ dir_s_mkdir - /usr/local/Frameworks

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

所有的包都下載完畢,但是我們卻發(fā)現(xiàn)最后報(bào)了兩條錯(cuò)誤,大概意思是公式已經(jīng)建立,但是在創(chuàng)建連接的時(shí)候因?yàn)闆](méi)有權(quán)限而發(fā)生意外錯(cuò)誤。在報(bào)錯(cuò)信息里我們看到一個(gè)目錄/usr/local/Frameworks,我們先去找一下這個(gè)目錄:

open /usr/local/Frameworks

發(fā)現(xiàn)這個(gè)目錄竟然不存在,那我們就來(lái)手動(dòng)創(chuàng)建一個(gè):

sudo mkdir /usr/local/Frameworks

創(chuàng)建好目錄之后,再來(lái)解決權(quán)限問(wèn)題:

sudo chown $(whoami):admin /usr/local/Frameworks

不報(bào)錯(cuò)即為修改成功,修改好權(quán)限之后,還需要手動(dòng)執(zhí)行一下安裝時(shí)未完成的創(chuàng)建連接:

brew link python3

連接成功。咱們來(lái)查看一下當(dāng)前系統(tǒng)下的python3的信息:

brew info python3

發(fā)現(xiàn)python3被安裝到了/usr/local/bin/python3目錄下,有興趣的小伙伴自行前往查看想過(guò)配置文件。

到這里python3的安裝就算完成了,不過(guò)可能有小伙伴已經(jīng)發(fā)現(xiàn),不管是在終端運(yùn)行python -V查看版本號(hào)還是直接運(yùn)行python啟動(dòng)python命令行模式,默認(rèn)的python版本還是系統(tǒng)自帶的2.*版本。其實(shí)這時(shí)候只運(yùn)行命令時(shí)需要把python改為python3就行了,當(dāng)然,有興趣的小伙伴也可以嘗試配置一下默認(rèn)版本,把當(dāng)前系統(tǒng)的默認(rèn)版本修改為3.*版本。知乎上已經(jīng)貼出了各種各樣的方法,我這里就不多做贅述了。

后記:

幫同事用上面的方法安裝不了,就去了官網(wǎng)下載了安裝包安裝

解析器的位置在 /Library/Frameworks/Python.framework/Versions/3.7/bin/python3.7 (在配置文件里面也有記錄)

總結(jié)

以上是生活随笔為你收集整理的电脑下载的python在哪里_mac下 python3 安装--有说明原电脑安装的文件在哪里的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。

如果覺(jué)得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。