这是我得到的信息.为了它的价值,我打开了我的注册表,注意到没有2.7文件夹,PythonCore直接进入InstallPath.有任何想法吗?
Set-ItemProperty : Cannot find path 'HKCU:\Software\Python\PythonCore\2.7\InstallPath' because it does not exist.
At C:\Users\...\Documents\WindowsPowerShell\Modules\virtualenvwrapper\win.psm1:127 char:21
+ set-itemproperty <<<< -path "HKCU:/Software/Python/PythonCore/$pyVer/InstallPath" -name "(default)" -value $pyBa
se
+ CategoryInfo : ObjectNotFound: (HKCU:\Software\...2.7\InstallPath:String) [Set-ItemProperty], ItemNotFo
undException
+ FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.SetItemPropertyCommand
Set-ItemProperty : Cannot find path 'HKCU:\Software\Python\PythonCore\2.7\PythonPath' because it does not exist.
At C:\Users\...\Documents\WindowsPowerShell\Modules\virtualenvwrapper\win.psm1:128 char:21
+ set-itemproperty <<<< -path "HKCU:/Software/Python/PythonCore/$pyVer/PythonPath" -name "(default)" -value "$pyBa
se\Lib;$pyBase\DLLs;$pyBase\Lib\lib-tk"
+ CategoryInfo : ObjectNotFound: (HKCU:\Software\...\2.7\PythonPath:String) [Set-ItemProperty], ItemNotFo
undException
+ FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.SetItemPropertyCommand
Run Code Online (Sandbox Code Playgroud) 我有一个下载的html文件,看起来像这样
<html class="theme_">
<head>
<body>
<div id="ad_1"></div>
...
<div id="wrapper">
<div id="top" style="height:11px;color:white;font-size:9px;font-weight:bold;"> </div>
...
<div id="content" style="border-top:none;">
...
<table id="user_list">
<tbody>
<tr class="trodd">
<td width="10%" valign="center" align="center">
<td class="list_art" style="width:160px;">
<td class="main_entry">
<h4>
<h5>
<a class="list_album" href="https://rateyourmusic.com/release/single/electra__ita_/feels_good__carrots_and_beets_/" title="[Album833409]">Feels Good (Carrots & Beets)</a>
<span class="rel_date">(1982) [Single]</span>
</h5>
</td>
<td></td>
</tr>
<tr class="treven">
Run Code Online (Sandbox Code Playgroud)
我需要访问表的每个<tr class="trodd">和<tr class="treven">条目user_list并检索href.这是我现在的代码,它只返回一个空数组.我无法理解的一件事是,cheerio是否能够找到这样的每一个,class="list_album"或者你必须在文件的层次结构中使用一堆$( ).
var cheerio = require("cheerio");
var file = "...path...";
var links = [];
var $ …Run Code Online (Sandbox Code Playgroud) 好吧,我讨厌开始另外几个关于此问题的其他线程,但是如何设置或调整PYTHONPATH呢?我对Mac很新,而且我成功完成此操作的唯一一次是在Windows上使用Rapid Enviroment Editor.这看起来像一个完全不同的野兽.我尝试安装Django并且它没能为2.7做,而我需要3.4,所以当前路径必须是2.7.which python在终端中运行显示/usr/bin/python目录,然后我无法进入该目录,更不用说通过浏览找到了.我看到我的Python 3.4目录有Update Shell Profile文件,但它有很多限制.我还看到其他线程在IDLE中提到了PYTHONPATH命令,并为终端创建了一个bash配置文件类型文件.在我需要运行不同版本的Python之前,我该如何设置它并且不再担心它?我在Mac 10.9.2上."解释我就像五岁".
这就是我做协会的方式:
class Event < ApplicationRecord
has_one :lineup
has_many :artists, :through => :lineup
belongs_to :venue
end
Run Code Online (Sandbox Code Playgroud)
和
class Lineup < ApplicationRecord
belongs_to :artist
belongs_to :event
end
Run Code Online (Sandbox Code Playgroud)
这就是我试图播种的方式
Event.create!(name: "The Function",
date: DateTime.new(2016,2,3,10,0,0,'+7'),
venue: Venue.create!(name: "Speakeasy", address: "Lynwood Ave", zip_code: "30312"),
lineup: Lineup.create!(:artist => Artist.create!(name: "DJ Sliink", bio: "jersey club king")),
description: "free free free")
Run Code Online (Sandbox Code Playgroud)
我得到的错误是ActiveRecord::RecordInvalid: Validation failed: Event must exist指向该lineup行的错误.如果我设置lineup: nil,我会得到相同的消息,然后一旦Event创建,尝试做event1.lineup = Lineup.create!....我有什么选择摆脱阵容对现有事件的依赖?根据我的理解,问题在于belongs_to关系,因为如果我artist:从Lineup实例创建中取出,我也会得到Artist must exist错误. …
python ×2
associations ×1
bash ×1
belongs-to ×1
javascript ×1
jquery ×1
macos ×1
node.js ×1
path ×1
powershell ×1
pythonpath ×1