通過virtualenv安裝tensorflow之后哩都,手動(dòng)打開IDLE引入tensorflow會(huì)出現(xiàn)報(bào)錯(cuò):不識(shí)別tensorflow, 解決辦法是通過virtualenv來啟動(dòng)IDLE税娜,方法如下:
1)先激活virtualenv:
在/Users/C_Ronaldo/targetDirectory/bin目錄下:
source activate
(如需關(guān)閉可用deactivate)
2) 運(yùn)行python-m idlelib.idle
如此便可以打開IDLE坐搔,然后新建文件,import tensorflow as tf ?沒毛病敬矩。
3)裝scipy庫(kù):
https://www.scipy.org/install.html#individual-packages概行,步驟:
進(jìn)入虛擬Python環(huán)境:source activate
python -m pip install --upgrade pip
修改# Consider adding this at the end of your ~/.bash_profile file export PATH="$PATH:/Users/your_user/Library/Python/3.5/bin"
Replace your_user with your username, and “3.5” with your Python version.
然后
pip install --user numpy scipy matplotlib ipython jupyter pandas sympy nose
4)解決報(bào)錯(cuò)找不到imread,解決方案:
pip install Pillow==3.4.2