简体   繁体   English

pip 在 virtualenv 上安装

[英]pip install on virtualenv

I installed VMWare on window and using a virtualenv for python project.我在 window 上安装了 VMWare,并为 python 项目使用了 virtualenv。

I activated the project project1 and pip3 install xxxxx modules I need.我激活了项目project1和 pip3 install 我需要的 xxxxx 模块。

But some of them had an import error and when I deactivated the virtualenv and pip3 install xxxx on the root, the import error is resolved.但是其中一些有导入错误,当我在根目录上停用 virtualenv 和 pip3 install xxxx 时,导入错误就解决了。

Are we supposed to pip install on the root, even though we activate the virtualenv?我们是否应该在 root 上安装 pip,即使我们激活了 virtualenv? Thanks.谢谢。

# A virtualenv's python pip call:
$ project1/bin/python -m pip install xxxxx

Where:在哪里:

  • project1: Is the env folder inside your root folder that contain all your python modules included python it self. project1:是你的根文件夹中的 env 文件夹,它包含你所有的 python 模块,包括 python 它自己。
  • -m is a python flag stand for: "run library module as a script". -m 是一个 python 标志,代表:“将库模块作为脚本运行”。
  • pip: Is the package manager. pip:是package经理。
  • install: is the pip command to install the desired module. install:是安装所需模块的 pip 命令。
  • xxxxx: its the desired python module (no, its not about film genres) xxxxx:它是所需的 python 模块(不,它与电影类型无关)

PS: In this way you ensure to be using the python version you installed on your virtualenv unequivocally PS:通过这种方式,您可以确保明确使用安装在 virtualenv 上的python版本

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM