How to add a package to python in Visual Studio 2017

前端 未结 2 1770
孤街浪徒
孤街浪徒 2021-01-04 01:28

I just installed the new VS2017 Preview and imported a Python project. This project has many import statements but VS2017 does show error in some import packages like cv2, s

相关标签:
2条回答
  • 2021-01-04 02:04

    You can, however it is not perfect.

    Firstly you need to bring up the Python Environments menu which can be accessed by going:

    Tools -> Python -> Python Environments

    It should bring up a sidebar (depending on how you have VS setup). There should be a dropdown box about half way down with the text "Overview". Click on that and you can select "Packages". This will bring up a textbox under it that will allow you to use standard pip commands to install packages.

    If you are on Windows though there is one added step for some packages though. As pip does not work well on Windows, due to the fact that the standard Windows package site (PyPI) does not yet have Windows wheels for a lot of common packages.

    Therefore, you are best off going to Christoph Gohlke's unofficial package site and then downloading the package you need. Once it's downloaded locally just copy and paste the LOCAL address into the textbox under "Packages". It will then install the package and you'll be good to go.

    0 讨论(0)
  • 2021-01-04 02:18

    I had same problem and i could get it working with visual studio 2017 python v3.6 using following instructions

    Install appropriate .whl file using this link (cpMN where you have Python M.N). contrib includes OpenCV-extra packages. For example, assuming you have Python 3.6, you might download **opencv_python-3.2.0+contrib-cp36-none-win_amd64.whl**

    link to download

    Then install it by running this command from installed folder

    pip install opencv_python-3*win_amd64.whl
    
    0 讨论(0)
提交回复
热议问题