python常见问题解决(待续)

问题1

我们在安装Python2和Python3时,配置好环境变量后,运行Python3的pip时,出问题

pip3 install requests
结果为

Fatal error in launcher:Unable to create process using ' " '

解决方法为

python3 -m pip install requests

问题2

有时候我们需要离线进行python包的安装,安装的方式通常用有1.运行exe文件,或者到解压缩zip/tar文件,到目录下,运行python setup.py install,但是往往因为各种安装环境的问题,使得安装失败,比如

RuntimeError:Broken Toolchain: cannot link s simple C program

Unable to find vcvarsall.bat

等等

有一个非常快捷的解决方案,就是安装wheel文件,

python3 -m pip install 某个包.whl

什么是wheel文件

Wheels are the new standard of python distribution and are intended to replace eggs. Support is offered in pip >= 1.4 and setuptools >= 0.8.

他的优势如下

  1. Faster installation for pure python and native C extension packages.
  2. Avoids arbitrary code execution for installation. (Avoids setup.py)
  3. Installation of a C extension does not require a compiler on Windows or macOS

(待续)

猜你喜欢

转载自blog.csdn.net/sinat_27634939/article/details/51636433