import os
print(os.getcwd()) #显示当前路径
os.chdir('F:PythonPython code') #更改目标路径
print(os.getcwd())
2. 安装模块
-
问题1
使用pip install 模块,显示
ValueError: Unable to find resource……
原因:pip版本过低,更新pip
使用指令:pip3 install --upgrade pip
若出现错误,卸载setuptools之后,再更新,然后重装setuptools。 -
问题2:Read timed out
更改下载地址,从国内的镜像网站下载模块:
(1)在C:Users[你的用户名]AppDataRoaming目录下创建名为pip的文件夹;
(2)在创建的pip文件夹内创建pip.ini文件,写入:
Markdown将文本转换为 HTML。
[global] timeout = 480 index-url = https://pypi.tuna.tsinghua.edu.cn/simple/#此为清华大学的镜像源 trusted-host = https://pypi.tuna.tsinghua.edu.cn/#写上这个就不会收到不信任网站警告
然后就可以正常安装模块啦~
可以使用pip list查看安装的第三方模块



