简体   繁体   中英

System Python virtual environment 'finds' the Anaconda Python instead - how to prevent this?

I have anaconda but now I have to get pure Python and create a venv there. So I install the most recent python. I go to the command prompt, and typing in 'python, I get exactly what I want:

Python 3.8.5 (tags/v3.8.5:580fbb0, Jul 20 2020, 15:43:08) [MSC v.1926 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information.

So I hit exit(), I set my project folder as a current directory and follow the procedure then to create and activate a venv:

cd ProjectEnv
python -m venv venv
venv\Scripts\activate

All this works fine. However, once I am inside this directory and I again type in 'python', I get the following:

Python 3.7.6 (default, Jan 8 2020, 20:23:39) [MSC v.1916 64 bit (AMD64)]:: Anaconda, Inc. on win32

Warning: This Python interpreter is in a conda environment, but the environment has not been activated. Libraries may fail to load. To activate this environment please see https://conda.io/activation

It is crucial I am using the pure python in order to install and use only packages I need in this venv, not the full Anaconda packages.

What steps am I missing to ensure I am always operating in pure Python? I would hate to have to uninstall Anaconda because this is what I have always used (because I hadn't been able to sort out all the import errors that come with Python in Windows).

Must have been while you tried installing anaconda. Anaconda usually gives you options to add it's python to path. It is advisable not to tick that option. It might be okay to uninstall and then reinstall anaconda, without adding anaconda's python to path.

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