简体   繁体   中英

Problem with installing pip in virtual enviroment

Im trying to make a virtual enviroment in vs code with this command in powershell:

py -3 -m venv venv

But i get this error message:

Error: Command '['C:\\Users\\Oscar GP\\lololol\\venv\\Scripts\\python.exe', '-Im', 'ensurepip', '--upgrade', '--default-pip']' returned non-zero exit status 101.

This makes the enviroment, but in the Scripts folder it doesn't make a activate file. but with this command it makes all the right files:

virtualenv venv

But with that command, it wont activate the venv correctly, and i cant fx use:

pip install flask

if i try installing flask, then i get this error message:

Unable to create process using 'C:\Users\Oscar GP\AppData\Local\Programs\Python\Python310\python.exe "C:\Users\Oscar GP\lololol\venv\Scripts\pip.exe" install flask'

I have latest versions of python and pip. I've tried uninstalling and reinstalling python and i tried the same commands in cmd and powershell.

If it matters execution policy is also unrestricted.

Anyone knows how to fix this?

After doing a little research, it seems there are a couple of reasons this may occur. However, someone else seems to have had the most similar problem here before. This may occur after upgrading python versions, in which case run sudo apt install python3.{new_version}-venv where new_version is the latest version of python on your system (or whichever version you are using to develop). Another possible listed solution was to uninstall python, then reinstall, and make sure to click the install for all users option. The last likely solution is to run the command python -m venv --clear --symlinks./venv to recreate your vent. Hope one of these works out:).

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