shaoheshaohe 发表于 2019-9-3 21:27:38

conda/pip常用命令

本帖最后由 shaoheshaohe 于 2020-10-13 11:28 编辑

注:为了加速安装,可以使用conda的国内源
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
conda config --set show_channel_urls yes

一、conda
1-创建环境
conda create -n mypy36 python=3.6
2-激活环境
activate name

conda activate name
3-安装包
conda install pkg=ver
4-查看已安装的python包
conda list
5-查看已安装的环境
conda info --envs

conda env list
6-conda移除名为pkg的包
conda remove pkg
7-conda移除名为test的环境
conda remove -n test --all

二、安装开发包
conda install numpy matplotlib pandas scipy seaborn

备选:
pip install numpy matplotlib pandas scipy seaborn
pip install scikit-learn -i https://pypi.tuna.tsinghua.edu.cn/simple



shaoheshaohe 发表于 2019-9-3 21:51:24

pip install torchvision==0.2 -i https://pypi.tuna.tsinghua.edu.cn/simple

言木心 发表于 2019-9-4 21:23:57

很有用,感谢

徐长亮 发表于 2019-9-4 22:58:50

使用conda创建python环境(例如):
conda create -n python2.7 python=2.7
conda activate python2.7

与使用 virtualenv, mkvirtualenv, 或者pipenv创建python虚拟环境的区别是什么? 这块不太理解.

比如:
1.
virtualenv -p C:\Users\clark_xu\.conda\envs\python2.7\python.exe virtualenv_2.7
C:\Users\clark_xu\.conda\envs\python2.7\virtualenv_2.7\Scripts\activate

2.
virtualenvwrapper.bat
set WORKON_HOME=C:\workspace\python_env
echo %WORKON_HOME%
mkvirtualenv --python=C:\Users\clark_xu\.conda\envs\python2.7\python.exe mkvirtualenv_2.7
workon mkvirtualenv_2.7

4.
pipenv --python 3.7
pipenv shell

呼风唤羽 发表于 2019-9-5 11:29:41

-激活环境可以
activate name
页: [1]
查看完整版本: conda/pip常用命令