1. 在Anaconda创建一个低版本的python环境,py364是这个虚拟环境的名字,后面是python版本号。像这样的虚拟环境可以创建很多个。
conda create -n py364 python=3.6.4
2. 如果报错CondaHTTPError: HTTP 000 CONNECTION FAILED for url
可以更换Anaconda的源 在win打开C:\Users\用户名\.condarc,linux则找到~/.condarc,修改内容如下,有时候vpn代理了 反而会报错
channels:
- https://mirrors.ustc.edu.cn/anaconda/pkgs/main/
- https://mirrors.ustc.edu.cn/anaconda/pkgs/free/
- https://mirrors.ustc.edu.cn/anaconda/cloud/conda-forge/
- http://mirrors.ustc.edu.cn/anaconda/pkgs/main/
- http://mirrors.ustc.edu.cn/anaconda/pkgs/free/
- http://mirrors.ustc.edu.cn/anaconda/cloud/conda-forge/
ssl_verify: true
show_channel_urls: true
3. conda activate py364命令激活这个环境
4. 打开Pycharm来使用这个环境,因为是已经创建好的,所以从Existing environment里面选
终端使用的就是这个环境
5. 手动安装requirements.txt 里面的包 导入进去
pip install -r requirements.txt
6.生成方式一:列出整个Python环境的包
pip freeze > D:\pycharm\requirements.txt
7. 配置多个 pip国内源 找到pip.ini文件 修改为
[global]
index-url=http://mirrors.aliyun.com/pypi/simple/
extra-index-url=
https://pypi.tuna.tsinghua.edu.cn/simple/
http://pypi.mirrors.ustc.edu.cn/simple/
[install]
trusted-host=
mirrors.aliyun.com
pypi.tuna.tsinghua.edu.cn
pypi.mirrors.ustc.edu.cn