简体   繁体   中英

create virtual environment using pipenv

i want to have two version of a module, one version in pip(eg:newer version) and the other(eg: older version) in pipenv, but when i install a package using pipenv, it will also works with pip, i don't know how to create a different environment with pipenv in pycahrm IDE that the packages won't install in pip.

and also pycharm inform me this code every time i execute a command using pipenv:

Courtesy Notice: Pipenv found itself running within a virtual environment, so it will automatically use that environment, instead of creating its own for any project. You can set PIPEN V_IGNORE_VIRTUALENVS=1 to force pipenv to ignore that environment and create its own instead. You can set PIPENV_VERBOSITY=-1 to suppress this warning.

how can i set pipenv_ignore_virtualenvs to 1?

is it even possible to use two different enviroment at one time?

Basically, you can't, because it doesn't depend on pip (or pipenv or poetry) where the packages should be installed. Python will install packages wherever it's configured to do based on the values of sys.prefix or sys.prefix_exec , as explained here .

If you want to manage two different versions of a dependency, the one thing I can think of is having two separate virtual environments, each with its own dependencies. Then, you can switch between environments as you please. But you can't have two versions of the same package installed (unless you modify its source and install it locally as well) in the same environment, and definitely changing between pip or any dependency installation tool won't help you.

Here 'sa nice article that explains what happens when you activate a virtual environment and why it does not depend on pip where they are installed

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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