我在这里要做的是将python3作为我的默认python.除了自动安装在mac上的python 2.7之外,我用自制软件安装了python3.这是我关注的网站.http://docs.python-guide.org/en/latest/starting/install3/osx/#install3-osx
我想我很好地遵循了每条指令,新安装了xcode,命令行工具和自制程序.但这是我的小困惑发生.
该脚本将解释它将进行的更改,并在安装开始之前提示您.安装Homebrew后,将Homebrew目录插入PATH环境变量的顶部.您可以通过在〜/ .profile文件的底部添加以下行来完成此操作
export PATH =/usr/local/bin:/ usr/local/sbin:$ PATH
我真的很困惑这是什么,但我得出结论,我应该在〜/ .profile文件的底部添加以下行.所以我在终端打开.profile打开了〜/ .profile文件,并在底部添加了以下行.现在它看起来像这样.
export PATH=/usr/local/bin:/usr/local/sbin:$PATH
# Setting PATH for Python 3.6
# The original version is saved in .profile.pysave
export PATH=/usr/local/bin:/usr/local/sbin:$PATH
Run Code Online (Sandbox Code Playgroud)
然后我做了brew install python,当我做python --version时希望看到python3 . 但它只是向我展示了python 2.7.10.我希望我的默认python是python3而不是2.7
我从网站上找到了一点线索.
我安装了Python 3吗?
$ python --version
Python 3.6.4
Run Code Online (Sandbox Code Playgroud)
如果你仍然看到2.7确保PATH/usr/local/bin /取/ usr/bin /
也许它必须与PATH做点什么?有人可以用简单的英语解释什么是PATH究竟是什么以及当我在终端中运行python -version时如何使我的默认python成为python3 …
我正在尝试使用 Jekyll 设置 github 页面,目前它使用的是minima theme,我想将其更改为jekyll-theme-hacker。
所以,我去了 Gemfile,我补充说
gem "github-pages", group:jekyll_plugins
Run Code Online (Sandbox Code Playgroud)
在下面
gem "minima", "~>2.5"
Run Code Online (Sandbox Code Playgroud)
保存后,我做了
bundle install
Run Code Online (Sandbox Code Playgroud)
但这给了我错误。
Bundler could not find compatible versions for gem "jekyll":
In snapshot (Gemfile.lock):
jekyll (= 4.0.0)
In Gemfile:
jekyll (~> 4.0.0)
jekyll-theme-hacker was resolved to 0.0.4, which depends on
jekyll (~> 3.3)
Running `bundle update` will rebuild your snapshot from scratch, using
only
the gems in your Gemfile, which may resolve the conflict.
Run Code Online (Sandbox Code Playgroud)
我对 Jekyll 和编程很陌生,我想知道为什么会这样。
据我所知,Bundler 是一个 …
我正在尝试使用 Beautifulsoup Python 从网站上抓取一些数据,但它没有返回它应该返回的值。以下是我的代码。
import requests
from bs4 import BeautifulSoup
url = 'https://finance.naver.com/item/sise.nhn?code=005930'
# send a HTTP request to the URL of the webpage I want to access
r = requests.get(url)
data = r.text
# making the soup
soup = BeautifulSoup(data, 'html.parser')
print(soup.find('iframe', attrs={'title': '?? ??'}))
Run Code Online (Sandbox Code Playgroud)
它返回,
<iframe bottommargin="0" frameborder="0" height="360" marginheight="0" name="day" scrolling="no" src="/item/sise_day.nhn?code=005930" title="?? ??" topmargin="0" width="100%"></iframe>
Run Code Online (Sandbox Code Playgroud)
打印结果中不包含 HTML 标签。但是,如果我查看网页上的开发人员工具,它清楚地显示“iframe”标签中有很多标签。
所以我的问题是,为什么我的代码不返回我从网页上的开发人员工具中看到的“iframe”标签内的所有标签?
我试过查找一些信息,但没有一个给我明确的答案。是因为它是由 javascript 加载的吗?如果是这样,我该如何检查我尝试抓取的网页是否已由 javascript 加载?
最后,如果我想要的数据是由 javascript 加载的,我应该使用什么模块/库来抓取它?
python ×2
blogs ×1
dependencies ×1
homebrew ×1
jekyll ×1
macos ×1
python-3.x ×1
ruby ×1
terminal ×1