简体   繁体   中英

How to manually install python packages for VS Code in windows?

I am not able to download any python packages via VS Code on my office Windows system due to the proxy. Is there a way that I can do it manually by downloading and placing the downloaded files at the right place?

eg acutally i can see the matplotlib package in https://pypi.org/simple/matplotlib/ , but cannot download it from office as blocked by firewall.

So, though I set up proxy in vs code terminal as:

> (env) C:\Playground\vscode\py\ms>set
> HTTPS_PROXY=https://username:password@proxy.mycompany.com:8080
> 
> (env) C:\Playground\vscode\py\ms>set
> HTTP_PROXY=http://username:password@proxy.mycompany.com:8080

, no wonder it failed when I tried to install matplotlib:

> (env) C:\Playground\vscode\py\ms>easy_install matplotlib Searching for
> matplotlib Reading https://pypi.python.org/simple/matplotlib/
> Downloading
> https://files.pythonhosted.org/packages/51/fe/84ab101f8ab543d89b6a128326f62adcdafd2781ab8362a737e6ce78eea7/matplotlib-3.1.0.tar.gz#sha256=1e0213f87cc0076f7b0c4c251d7e23601e2419cd98691df79edb95517ba06f0c
> error: Can't download
> https://files.pythonhosted.org/packages/51/fe/84ab101f8ab543d89b6a128326f62adcdafd2781ab8362a737e6ce78eea7/matplotlib-3.1.0.tar.gz#sha256=1e0213f87cc0076f7b0c4c251d7e23601e2419cd98691df79edb95517ba06f0c:
> 403 Forbidden

如果您已经下载了相应的wheel文件,您可以指向该文件的pip并安装它,例如python -m pip install path/to/package.whl

Try setting the global proxy in your Windows command line and then try installing the package from there. The same thing happened with me and I was able to solve it using this approach.

Moreover, as far as placing the files in the right place is concerned, you have to activate the respective virtual environment before installing the required packages.

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