简体   繁体   English

安装后点子安装方法不起作用

[英]Pip install method not working after installation

I'm trying to install matplotlib but keep getting the error 我正在尝试安装matplotlib,但一直收到错误消息

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' 启动器中的致命错误:无法使用'“ 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“安装matplotlib'

To fix this I've tried uninstalling and reinstalling python as well as pip. 为了解决这个问题,我尝试卸载并重新安装python和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. 这是python使用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. 看来pip在您的本地系统中,因此请执行以下操作。

create a python script called "package_installer.py": 创建一个名为“ package_installer.py”的python脚本:

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. 然后运行代码,脚本中的install调用您要安装的任何内容。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM