Python pip install module is not found. How to link python to pip location?

后端 未结 10 1345
青春惊慌失措
青春惊慌失措 2020-11-27 15:37

I\'m a newbie and I needed the pySerial and feedparser module for my projects. I\'m running Mountain lion.

I followed the following tutorial so that I could upgrade

10条回答
  •  甜味超标
    2020-11-27 15:43

    For the sake of anyone also using visual studio from a windows environment:

    I realized that I could see my module installed when i ran pip install

    py pip install [moduleName] 
    py pip list
    

    However debugging in visual studio was getting "module not found". Oddly, i was successfully running import [moduleName] when i ran the interpreter in powershell.

    Reason:

    visual studio was using the wrong interpreter at: C:\Users\[username]\AppData\Local\Programs\Python\Python37\

    What I REALLY wanted was visual studio to use the virtualenv that i setup for my project. To do this, right click Python Environments in "solution explorer", select Add Virtual Environment..., and then select the folder where you created your virtual environment. Then, under project settings, under the General tab, select your virtual environment in the dropdown.

    Now visual studio should be using the same interpreter and everything should play nice!

提交回复
热议问题