我看过其他文章,但我无法纠正这个问题。我对Python很新。 我的问题:
which -a python
/Users/user/anaconda/bin/python
/usr/bin/python
which -a jupyter
/Users/user/anaconda/bin/jupyter
/usr/local/bin/jupyter
sys.path
['',
'/Users/user/anaconda/lib/python27.zip',
'/Users/user/anaconda/lib/python2.7',
'/Users/user/anaconda/lib/python2.7/plat-darwin',
'/Users/user/anaconda/lib/python2.7/plat-mac',
'/Users/user/anaconda/lib/python2.7/plat-mac/lib-scriptpackages',
'/Users/user/anaconda/lib/python2.7/lib-tk',
'/Users/user/anaconda/lib/python2.7/lib-old',
'/Users/user/anaconda/lib/python2.7/lib-dynload',
'/Users/user/anaconda/lib/python2.7/site-packages/runipy-0.1.1-py2.7.egg',
'/Users/user/anaconda/lib/python2.7/site-packages/setuptools-20.7.0-py2.7.egg',
'/Users/user/anaconda/lib/python2.7/site-packages',
'/Users/user/anaconda/lib/python2.7/site-packages/PIL',
'/Users/user/anaconda/lib/python2.7/site-packages/Sphinx-1.2.3-py2.7.egg',
'/Users/user/anaconda/lib/python2.7/site-packages/IPython/extensions',
'/Users/user/.ipython']
更多信息: 我在OSX上运行Jupyter Notebook,但是当我从终端I加载Python时也收到同样的错误。
$transactionfailed = false;
$mysqliconn->query("begin;");
//query 1
$result=$mysqliconn->query("insert into table(col1,col2) values('$val1','val2')");
if(!$result){$transactionfailed=true;}
//query 2
$result=$mysqliconn->query("insert into table2(col1,col2) values('$val1','val2')");
if(!$result){$transactionfailed=true;}
if($transactionfailed){$mysqliconn->query("rollback;");}
else{$mysqliconn->query("commit;");}
die();