python的環境其實很簡單,看喜好。可以conda指令去建虛拟環境,用conda命名将環境配置好,然後在pycharm中
選擇"preference --> Project:項目名字 -->Project Interpreter ,右側 ”+“ 點選 add ---> Conda Environment,右側Existing environment 下方的 interpreter 選擇自己建立的環境即可。

Conda 常用指令:
conda 環境指令
conda env --info 列出conda中目前有的python環境 或者conda env list
conda create -n xxxx python=3.5 #建立名字為xxx且指定python為3.5的虛拟環境
conda remove -n conda remove -n py3tf1-14 --all # 删除名為 py3tf1-14的環境
conda指令替換source指令用來激活和關閉環境
conda activate python_temp0323 激活python_temp0323環境
conda deactivate python_temp0323 關閉python_temp0323環境
conda deactivate 退出目前環境(退到了預設的)
conda list #檢視已經安裝的檔案包
conda update xxx #更新xxx檔案包
conda install pandas 安裝pandas庫
conda install --channel https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free tensorflow=1.13.1 conda 指定從某個channel源(此清華鏡像)來安裝指定版本的tensorflow
conda uninstall xxx #解除安裝xxx檔案包
如果你想要把一個源最先使用,那麼重新添加一次即可。如使用清華鏡像源
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
conda config --set show_channel_urls yes
cond可以一次性導出或安裝所有需要的包
conda批量導出、安裝元件(requirements.txt)
conda list -e > requirements.txt conda批量導出包含環境中所有元件的requirements.txt檔案
conda install --yes --file requirements.txt conda 批量安裝
用pip也可以
pip freeze > requirements.txt
pip install -r requirements.txt
附件:
鏡像源位址:
阿裡雲 https://mirrors.aliyun.com/pypi/simple/
中國科技大學 https://pypi.mirrors.ustc.edu.cn/simple/
豆瓣(douban) https://pypi.douban.com/simple/
清華大學 https://pypi.tuna.tsinghua.edu.cn/simple/
參考:
conda常用指令:安裝,更新,建立,激活,關閉,檢視,解除安裝,删除,清理,重命名,換源,問題https://blog.csdn.net/zhayushui/article/details/80433768
(Ana)conda常用指令整理
https://www.jianshu.com/p/f0602213f400
PS
谷歌的colab運作GitHub代碼。
在chrome浏覽器中安裝colab插件。當進入github網站上想要運作的代碼頁面後,直接點選chrome浏覽器中右上角的colab插件圖示,浏覽器即會在新的标簽頁用colab打開想要運作的代碼。