Dealing with multiple Python versions and PIP?

后端 未结 23 2788
走了就别回头了
走了就别回头了 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:20

    If you have multiple versions as well as multiple architectures (32 bit, 64 bit) you will need to add a -32 or -64 at the end of your version.

    For windows, go to cmd and type py --list and it will produce the versions you have installed. The list will look like the following:

    Installed Pythons found by py Launcher for Windows
     -3.7-64 *
     -3.7-32
     -3.6-32
    

    The full command as an example will be:

    py -3.6-32 -m pip install (package)
    

    If you want to get more indepth, to install a specific version of a package on a specific version of python, use ==(version) after the package. As an example,

    py -3.6-32 -m pip install opencv-python==4.1.0.25
    

提交回复
热议问题