1. 程式人生 > >anaconda 和 python 安裝;jupyter 開發環境的使用

anaconda 和 python 安裝;jupyter 開發環境的使用

1\anaconda 和 python 安裝

1.作業系統:win7,配置環境時需要聯網。
2.anaconda 安裝
anaconda 下載地址:https://www.continuum.io/downloads/。根據電腦的操作
系統位數,選擇下載 32 位和 64 位的 anaconda;
安裝 anaconda 到 D:\anaconda 資料夾下。
3. 配置環境 python3.6
執行“開始\所有程式\anaconda3\Anaconda Prompt”,輸入命令“conda create 
--name py36 python=3”,出現“The following new packages will be installed”,輸
入“y”,等待安裝完成;
輸入命令“activate py36”啟用 python3.6。
4. 設定 jupyter notebook 工作路徑
在環境變數中新增目錄“D:\ anaconda\Scripts”。
執行 cmd,輸入命令“jupyter notebook --generate-config”產生配置檔案,配
置檔案目錄見 cmd 輸出。
用記事本開啟這個目錄下的配置檔案 jupyter_notebook_config.py,把其中一
行#c.NotebookApp.notebook_dir = ''替換成
c.NotebookApp.notebook_dir = r'C:\Users\GJB\Desktop'
(注意 C:\Users\GJB\Desktop 為本機的桌面目錄)
5.安裝 python
Python3.6 下載地址:https://www.python.org/downloads/release/python-362/。
64 位作業系統選擇 Windows x86-64 executable installer,32 位作業系統選擇
Windows x86 executable installer。下載後安裝到 D:\python 資料夾下

2,jupyter 開發環境的使用

1,cmd輸入jupyter notebook,進入jupyter,啟動web頁面服務在windows桌面建立一個目錄,作為jupyter的目錄,將logisitic+regression.ipynb等檔案拷貝到目錄裡,就可測試。

2,jupyter中的多行顯示
from IPython.core.interactiveshell import InteractiveShell
InteractiveShell.ast_node_interactivity ="all"3,匯入包
import re
import numpy as np
import pandas as pd
from pandas import Series





from IPython.core.interactiveshell import InteractiveShell
InteractiveShell.ast_node_interactivity = "all"
import numpy as np
import numpy.random as randn
import numpy.linalg as la
import pandas as pd
import os
import matplotlib.pyplot as plt
from datetime import datetime
from sklearn import linear_model
%matplotlib inline