简体   繁体   中英

How can I get packages installed in venv to show up in PyCharm project?

I am trying to use a virtual environment (venv) as the project interpreter for a PyCharm project. The virtual environment is called venvtest and is set up within the PyCharm project directory. That is, the project directory is /Users/gitanjali/Desktop/plot_bridges2 and the path to the virtual environment is /Users/gitanjali/Desktop/plot_bridges2/venvtest .

I've installed a number of packages in venvtest through Terminal using pip. I'd like to be able to import three in particular -- basemap, matplotlib, and numpy -- to some code that I'm writing.

When I set the PyCharm project interpreter to be venvtest , those packages don't show up.

I've tried the following things to fix this problem.

I've made sure that the path to the venv is set correctly ( /Users/gitanjali/Desktop/plot_bridges2/venvtest/bin/python ).

I've called pip freeze --local from within the PyCharm project, and I get a list of all the packages I expect, since I installed them.

(venvtest) (base) DN0a229530:plot_bridges2 gitanjali$ pip freeze -- local
asn1crypto==0.24.0
backports-abc==0.5
backports.functools-lru-cache==1.5
basemap==1.2.0
...
six==1.12.0
tornado==6.0.2
urllib3==1.24.3

However, when I look at the Project Interpreter window in PyCharm, none of these packages show up.

I've tried recreating the venv and invalidating caches and restarting PyCharm, but none of these have solved the problem.

What next steps should I try to get PyCharm to recognize the packages that exist in venvtest ?

Try installing those by "file =>setting=> project interpreter=>addsign on upright => type in the package u want to install on top => click install package on bottom=>wait for the installation =>try it out!" if still can't work, try pycharm help

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