我想从我的测试脚本进行数据迁移mssql-server到oracle server.为此,我必须pyodbc python为Ubuntu安装包,它具有依赖性unixodbc.当我尝试安装unixodbc-dev使用时:
sudo apt-get install unixodbc-dev
Run Code Online (Sandbox Code Playgroud)
它给出了破坏的包错误:
The following packages have unmet dependencies:
unixodbc-dev : Depends: unixodbc (= 2.3.1-4.1)
Depends: odbcinst1debian2 (= 2.3.1-4.1) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
Run Code Online (Sandbox Code Playgroud)
但是使用aptitude(sudo aptitude install unixodbc-dev)它正在安装并删除一些SQL服务器文件,因为我的文件SQL-server发生故障.
再次SQL server使用此命令安装:
sudo apt-get install mssql-server mssql-tools …Run Code Online (Sandbox Code Playgroud) 我试图安装Pandas有pip,但遇到了一个问题.以下是详细信息:
Mac OS Sierra
which python => /usr/bin/python
python --version => Python 2.7.10
Inside "/System/Library/Frameworks/Python.framework/Versions" there is the following
2.3 2.5 2.6 2.7 Current
Run Code Online (Sandbox Code Playgroud)
我希望Python 2.7.10在"/ usr/bin/python"中链接pandas
当我这样做时pip install pandas,我收到以下错误消息:
Collecting pandas
Using cached pandas-0.19.2-cp27-cp27m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl
Requirement already satisfied: pytz>=2011k in
/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python (from pandas)
Requirement already satisfied: python-dateutil in
/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python (from pandas)
Requirement already satisfied: numpy>=1.7.0 in
/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python (from pandas)
Installing collected packages: pandas
Exception:
Traceback (most recent call last):
File "/Library/Python/2.7/site-packages/pip-9.0.1-
py2.7.egg/pip/basecommand.py", …Run Code Online (Sandbox Code Playgroud) 我在我的rails应用程序控制器中声明了一个全局变量,我$decrypted_attessec = "verified decrypted cookie"在所有控制器上访问它.一旦我关闭浏览器窗口,全局变量必须设置为nil或destroy,这是没有完成的.
在我的情况下,它总是保持初始值,"verified decrypted cookie"在这种情况下,然而,服务器重新启动销毁全局变量并重新初始化它,我想在关闭浏览器时完成.
我的代码:
application_controller.rb
def validate_user
$decrypted_attessec = "verfied decrypted cookie"
#I am getting value of $decrypted_attessec as verfied decrypted cookie from different action which would be either an empty or non-empty string
if !$decrypted_attessec.empty?
#redirect_to clicked path
else
redirect_to "login url"
end
end
Run Code Online (Sandbox Code Playgroud)
Welcome_controller.rb <application_controller.rb
if $decrypted_attessec.empty?
before_action :validate_user, :except => [:index, :csplogin]
end
Run Code Online (Sandbox Code Playgroud)
我在哪里错了代码?
我不小心从中删除MySQL了Ubuntu 16.04.现在当我再次尝试安装时,会出现错误.请帮我解决这个错误:
update-alternatives: error: alternative path /etc/mysql/my.cnf.fallback doesn't exist
dpkg: error processing package mysql-common (--configure):
subprocess installed post-installation script returned error exit status 2
E: Sub-process /usr/bin/dpkg returned an error code (1)
Run Code Online (Sandbox Code Playgroud) 我在我的配置中使用了Oracle 11gUbuntu 16.04,它的工作非常好.
以前我尝试安装Oracle 12c,这是一些错误,所以我删除它并安装11克.
现在,我的问题是,当我尝试使用import cx_Oracle时python,它会给出导入错误libclntsh.so.12.1.
这是整个输出:
>>> import cx_Oracle
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: libclntsh.so.12.1: cannot open shared object file: No such file or directory
Run Code Online (Sandbox Code Playgroud)
我的.bashrc文件包含以下条目:
export PATH="/home/marvin/anaconda2/bin:$PATH"
export ORACLE_HOME=/u01/app/oracle/product/11.2.0/xe
export ORACLE_SID=XE
export NLS_LANG=`$ORACLE_HOME/bin/nls_lang.sh`
export ORACLE_BASE=/u01/app/oracle
export LD_LIBRARY_PATH=$ORACLE_HOME/lib
export PATH=$ORACLE_HOME/bin:$PATH
Run Code Online (Sandbox Code Playgroud)
为什么还要尝试Oracle 12c?11g配置或12c卸载中是否有错误?
我已经尝试卸载并重新安装cx_oracle通过pip.
我想将数据帧转换为json,这是我目前拥有的代码:
my_frame = pd.DataFrame(
{'Age':[30, 31],
'Eye':['blue', 'brown'],
'Gender': ['male', 'female']})
my_frame = my_frame.to_json(orient='records')
my_frame
Run Code Online (Sandbox Code Playgroud)
结果:
'[{"Age":30,"Eye":"blue","Gender":"male"},{"Age":31,"Eye":"brown","Gender":"female"}]'
Run Code Online (Sandbox Code Playgroud)
我想键添加到JSON对象,并添加关键信息在一个从数据框转换的整个数据.
add_keys = {'id': 101,
'loc': 'NY',
}
add_keys['info'] = my_frame
add_keys
Run Code Online (Sandbox Code Playgroud)
结果:
{'id': 101,
'info': '[{"Age":30,"Eye":"blue","Gender":"male"},
{"Age":31,"Eye":"brown","Gender":"female"}]',
'loc': 'NY'}
Run Code Online (Sandbox Code Playgroud)
我想在info中打印两个记录中的每一个,但是当我运行这个迭代代码时,它会输出字符串的每个字符而不是整个记录.我相信这可能是我如何添加密钥的问题.
for item in add_keys['info']:
print(item)
Run Code Online (Sandbox Code Playgroud)
任何帮助非常感谢!