简体   繁体   中英

Pip install method not working after installation

I'm trying to install matplotlib but keep getting the error

Fatal error in launcher: Unable to create process using '"c:\\users\\sharjeel jan\\appdata\\local\\programs\\python\\python36-32\\python.exe" "C:\\Users\\Sharjeel Jan\\AppData\\Local\\Programs\\Python\\Python36-32\\Scripts\\pip.exe" install matplotlib'

To fix this I've tried uninstalling and reinstalling python as well as pip. I've also tried to change the paths by following a bunch of tutorials.

So far I am certain that the path I am using is correct as I used this code to obtain it although the error remains:

import os
import sys
print(os.path.dirname(sys.executable))

If anyone could please help, that would be greatly appreciated!

This is a nice way for python to install packages using pip. This will make it so you don't need to worry about paths. It looks like pip is in your local system so do this by the following.

create a python script called "package_installer.py":

import pip
import sys
import subprocess

def install(package):
    subprocess.call([sys.executable, "-m", "pip", "install", package])

#example install itertools
install('itertools')

Then run the code, with the install in the script calling anything you'd like to install.

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