python 读取asc文件_python 爬虫第一课:文件读取

python 环境

mac自带的是2.7,首先需要升级到python3

使用homebrew升级,先安装Homebrew

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

然后使用brew install

brew install python3

查看python3 --version 是 3.7.4

我用的编译器是VSCode,不知道为什么要求装pip

sudo easy_install pip

如果要在 VSCode 里面直接运行 python,需要选择对应的 python interpreter(否则默认用的是python 2)

方法文档理由说明,如下

From within VS Code, select a Python 3 interpreter by opening the Command Palette(⇧⌘P), start typing the Python: Select Interpreter command to search, then select the command.

做完这些,终于可以运行成功了,之前是python2,会不认识encoding这个参数

你可能感兴趣的:(python,读取asc文件)