天天看点

pipenv创建Python虚拟环境

  1. 创建项目根目录
  2. shift+右键在根目录中打开power shell
  3. pipenv install

    创建虚拟环境
  4. pipenv shell

    显式激活虚拟环境
  5. 在pycharm中将python解释器设置为虚拟环境中的解释器(

    pipenv --venv

    可查看项目对应的虚拟环境路径)

tips:

pipenv install 安装模块时有时候会很慢

可以设置国内源:Pipfile文件中[source]下面url属性,比如修改成:url = “https://pypi.tuna.tsinghua.edu.cn/simple”