Dealing with multiple Python versions and PIP?

后端 未结 23 2783
走了就别回头了
走了就别回头了 2020-11-21 06:58

Is there any way to make pip play well with multiple versions of Python? For example, I want to use pip to explicitly install things to either my s

23条回答
  •  天涯浪人
    2020-11-21 07:29

    Another possible way could be using conda and pip. Some time you probably want to use just one of those, but if you really need to set up a particular version of python I combine both.

    1. I create a starting conda enviroment with the python I want. As in here https://docs.conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html. Alternatively you could set up the whole enviroment just using conda.

      conda create -n myenv python=3.6.4

    2. Then activate your enviroment with the python you like. This command could change depending on the OS.

      source activae myenv

    3. Now you have your python active then you could continue using conda but if you need/want to use pip:

      python -m pip -r requirements.txt

    Here you have a possible way.

提交回复
热议问题