Python库的引入

3种方式实现:
pycharm,
file -> settings->project ->project interpreter -> +号 ->搜索相应的库,不过网速慢,下载慢,容易下载失败

打开命令行
pip --default-timeout=1000 install -U 库名(如jieba)
这个下载慢,但是请求时间延长失败概率低

百度网盘啥的下载的库包,解压后,打开命令行,
cd 解压路径 回车
python setup.py install

对于已经下载了库却仍然不可用这个库,说明你安装的库所在的interpreter不是你现在程序所用的interpreter。
解决方法,
file -> settings->project ->project interpreter ->
设置图标 -> add -> exist environment -> 寻找路径, 找到你安装库的路径下的 python.exe, 你说你找不到,那你在命令行里再重复安装一遍,然后把生成的路径复制下来, 再粘贴到exist environment -》路径寻找的上方搜索中

猜你喜欢

转载自blog.csdn.net/qq_41904106/article/details/111148599