简体   繁体   English

如何在Windows中手动安装VS Code的python包?

[英]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. 由于代理,我无法通过我的办公室Windows系统上的VS Code下载任何python包。 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. 例如,我可以在https://pypi.org/simple/matplotlib/看到matplotlib软件包,但无法从防火墙阻止的办公室下载。

So, though I set up proxy in vs code terminal as: 所以,虽然我在vs代码终端中设置了代理:

> (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: ,难怪当我尝试安装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. 尝试在Windows命令行中设置全局代理,然后尝试从那里安装包。 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. 此外,就将文件放在正确的位置而言,您必须在安装所需的软件包之前激活相应的虚拟环境。

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

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