python -v
python3 -v
pip -v
pip3 -v
pypi 是 Python Package Index 的首字母简写,其实表示的是 Python 的 Packag 索引,这个也是 Python 的官方索引。
你需要的包(Package)基本上都可以从这里面找到。作为开源软件,你也希望能够贡献你的 Package 到这里供其他用户使用。
修改pip源
cd ~
cd .pip
ls | grep pip.conf
vi pip.conf
使用清华镜像源
[global]
index-url = https://pypi.tuna.tsinghua.edu.cn/simple
临时安装
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple scipy==0.13.3
如果没有.pip文件夹,请创建.pip文件夹和pip.conf文件
查看命令地址
which python
which python3
which pip
which pip3
查看 pip的版本,以及安装位置
python -m module-name
升级 pip
sudo python3 -m pip install —upgrade pip
安装 selenium
pip install -U 就是 —upgrade 的缩写
python3 -m pip install -U selenium
https://www.selenium.dev/
查看 selenium 的版本
检查所以的packages的安装
卸载 selenium
selenium
AttributeError: module ‘selenium.webdriver’ has no attribute ‘PhantomJS’
https://www.selenium.dev/selenium/docs/api/py/api.html
安装 phantomjs
https://phantomjs.org/download.html
phantomjs 是基于WebKit的服务器端 javascript API,它全面支持web而不需要浏览器支持,且运行速度快,它以原生方式支持web标准:DOM处理,CSS选择器,JSON,Canvas,SVG。
Phantomjs可以用于页面自动化,网络监控,页面截屏以及无界面测试等。<br />![image.png](https://cdn.nlark.com/yuque/0/2021/png/219938/1635765879693-e1bd2449-fe6c-499a-8210-9c6c20d15c0c.png#clientId=u78208534-0b85-4&crop=0&crop=0&crop=1&crop=1&from=paste&height=551&id=u25c0580f&margin=%5Bobject%20Object%5D&name=image.png&originHeight=1102&originWidth=1858&originalType=binary&ratio=1&rotation=0&showTitle=false&size=696875&status=done&style=none&taskId=uf1f927d6-9eb2-479d-ba8d-149c3ac42fa&title=&width=929)
ln -s
sudo ln -s /Users/xxx/phantomjs-2.1.1-macosx/bin/phantomjs /usr/local/bin/phantomjs
python3
>>> from selenium import webdriver
>>> derver = webdriver.PhantomJS()