【python】python入門常用設定
5、使用pycharm和pip安裝包的時候有些解決不了的錯誤,可以試著直接下載whl檔案進行安裝。
下載網站1:https://www.lfd.uci.edu/~gohlke/pythonlibs/#pandas pandas包名可以修改成所需
網站2:https://pypi.org/ 進入搜尋所使用的包即可。 注意找對系統版本,檔名cpxx為對應python版本號
4、pycharm安裝包時報錯 超時,可嘗試在安裝包的頁面點選 Manage Repositories選項,加入常用的國內映象,然後重新整理。
常用的國內映象地址列表如下:
阿里雲 http://mirrors.aliyun.com/pypi/simple
中國科技大學 https://pypi.mirrors.ustc.edu.cn/simple
豆瓣(douban) http://pypi.douban.com/simple
清華大學 https://pypi.tuna.tsinghua.edu.cn/simple
中國科學技術大學 http://pypi.mirrors.ustc.edu.cn/simple
或者在當前直譯器的 包 的 資料夾內摁住shift 右鍵執行powershell 輸入 pip install 包名安裝
有些包使用上面兩種方法還是安裝不上,提示timeout或者Could not find a version that satisfies the requirement
嘗試 pip install 包名-i http://pypi.douban.com/simple/ --trusted-host pypi.douban.com
報錯 Cannot unpack file C:\Users\ xxxxx 之後也未解決
3、使用在cmd命令列使用python xxxx.py 時報錯“python不是內部或外部命令,也不是可執行的程式或批處理檔案“
解決辦法:
- 將python.exe加入系統環境變數,讓python.exe和執行的.py檔案在相同目錄,使用python xxx.exe執行
- 直接使用python +空格+ py檔案路徑執行檔案。或者直接將python.exe檔案和.py檔案拖進cmd視窗執行,注意檔案中間空格
2、jupyter notebook 更改預設檔案路徑。
win+R cmd 命令輸入:jupyter notebook --generate-config ,找到對應config檔案(一般在C盤),開啟找到該行c.NotebookApp.notebook_dir = '預設路徑' 刪除#後儲存。
1 、Spyder 和 Pycharm設定預設配置資訊。
pycharm裡:settings 》editor 》file and code templates 選擇python script 進行編輯即可
Spyder 裡:tools,reference,editor,advance-setting,選擇edit temptlate for new modules進行設定
${DATE} ${TIME} %(username)s %(date)s 為常用的取預設時間、使用者名稱等資訊的命令。
${USER} 使用者名稱 ${NAME}獲取檔名 ${PRODUCT_NAME}獲取IDE軟體名