python 3.7與tensorflow安裝詳細(xì)步驟

tensorflow 64位系統(tǒng)上支持較好, 建議使用64位系統(tǒng)來(lái)安裝tensorflow.

windows 下安裝

pip使用國(guó)內(nèi)源會(huì)快速很多, 參考python pip 使用國(guó)內(nèi)源

安裝Python 3.6 x86-64

官網(wǎng): python Window x86-64

將python/scripts添加到環(huán)境變量中

本機(jī)安裝python, scripts的路徑可能是: C:\Users\James\AppData\Roaming\Python\Python37\Scripts, 將其添加到系統(tǒng)的PATH中.

image.png

安裝tensorflow

pip install --upgrade --ignore-installed tensorflow
pip install --upgrade --ignore-installed tensorflow-gpu
python -m pip install --upgrade --ignore-installed tensorflow (未加入到系統(tǒng)的PATH環(huán)境變量中時(shí), 可以使用該命令)

linux 下安裝

安裝依賴環(huán)境

yum -y install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel

下載python3

wget https://www.python.org/ftp/python/3.6.1/Python-3.6.1.tgz

安裝python3

mkdir -p /usr/local/python3
tar -zxvf Python-3.6.1.tgz
cd Python-3.6.1
./configure --prefix=/usr/local/python3
make && make install

建立python3的軟鏈接

ln -s /usr/local/python3/bin/python3 /usr/bin/python3

將/usr/local/python3/bin 加入PATH

> vim ~/.bash_profile
# .base_profile
# Get the aliases and functions
if [-f ~/.bashrc]; then
. ~/.bashrc
fi
# User spceific environment and startup programs
PATH=$PATH;$HOME/bin;
export PATH

按ESC, 輸入:wq, 回車退出, 然后再執(zhí)行命令:source ~/.bash_profile

安裝pip

安裝pip前需要前置安裝setuptools

wget --no-check-certificate https://pypi.python.org/packages/source/p/pip/pip-8.0.2.tar.gz#md5=3a73c4188f8dbad6a44d117eeb
tar -zxvf pip-8.0.2.tar.gz
cd pip-8.0.2
python3 setup.py build
python3 setup.py install

python編輯器

  • cmd
  • vim
  • pycharm python集成開發(fā)環(huán)境, 有免費(fèi)版
  • spyder3
  • colab
  • Colaboratory,一個(gè)免費(fèi)的Jupyter筆記本環(huán)境, 不需要進(jìn)行任何設(shè)置就可以使用, 并且完全在云端運(yùn)行

出錯(cuò)處理

1. 使用pip install --upgrade --ignore-installed tensorflow出現(xiàn)錯(cuò)誤consider using the '--user' option or check the permissions

image.png

修改執(zhí)行命令為: pip install --user --upgrade --ignore-installed tensorflow

相關(guān)鏈接

tensorflow官網(wǎng)
python官網(wǎng)

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容