简体   繁体   中英

New python venv is using global packages

So far I wasn't aware that I should be creating a new venv for each project and so, I installed every package I needed globally. Now when I want to start using python -m venv env, my program runs fine, even though I have installed no packages at all. I assume it uses global packages, because when I do pip freeze I get no packages listed.

I'm trying to create a requirements.txt file that'll list only the packages I need for this project, but it's empty, and my code runs fine! The include-system-site-packages = false is also set in the pyvenv.cfg file, I really don't get this.

Solved it. Apparently my app was using a global Flask package, which had access to other global packages. I uninstalled global Flask package, which forced my app to use the env Flask, along with other env packages.

Now requirements.txt gets rendered properly.

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