SWIG 3.0+Python 2.7 报错:TypeError in method ... 求指点 19C

最近需要用Python调用一个C++写的DLL接口,总是出问题于是做了一个小测试,发现有一个类初始化始终报错。
Python调用Dll接口中一个CreateEsunnyQuotClient 初始化方法 传递参数 IEsunnyQuotNotify * 的时候,出现错误,看起来是要传递一个指针变量,但是Python没有指针啊?直接使用ctypes 应该也不对吧,实在不解了。
TypeError: in method 'CreateEsunnyQuotClient', argument 1 of type 'IEsunnyQuotNotify * '

具体错误信息如图:
图片说明

下面是我做的一些测试用的文件:头文件 example.h、C++文件 example.cpp、SWIG接口文件 example.i、distutils安装文件 setup.py、测试文件 TestExample.py、
我用的环境是Python 2.7 32位、VS2015(2010也可以)
希望高人指点,已经忙了3天3夜了还是没有结果。十分感谢。


/* example.h */

 class IEsunnyQuotNotify
{
public:
    /**
    *登录反馈回调函数
    * @param err 错误号 0表示登录成功,否则失败
    * @param errtext 错误信息
    * @return 0表示成功,否则失败
    */
    virtual int OnRspLogin(int err,const char *errtext)=0;
};

//创建接口指针(使用前调用)
IEsunnyQuotClient * CreateEsunnyQuotClient(IEsunnyQuotNotify * notify);

//释放接口指针(使用后调用)
void DelEsunnyQuotClient(IEsunnyQuotClient * client);

/* example.cpp */

 int IEsunnyQuotClient::Connect(const char *ip, int port) {
    return 0;
}

void IEsunnyQuotClient::DisConnect() {
    return;
}

class EsunnyQuotClient : public IEsunnyQuotClient {
    int Connect(const char *ip, int port) {
        return 0;
    };
    void DisConnect() {
        return ;
    };
};

int IEsunnyQuotNotify::OnRspLogin(int err, const char *errtext) {
    return 0;
}

IEsunnyQuotClient * CreateEsunnyQuotClient(IEsunnyQuotNotify * notify) {
    return &EsunnyQuotClient();
}

/* example.i*/

 /* File : example.i */
%module example

%{
#include "example.h"
%}

class Shape {
public:
  Shape() {
    nshapes++;
  }
  virtual ~Shape() {
    nshapes--;
  }
  double  x, y;
  void    move(double dx, double dy);
  virtual double area() = 0;
  virtual double perimeter() = 0;
  static  int nshapes;
};

class Circle : public Shape {
private:
  double radius;
public:
  Circle(double r) : radius(r) { }
  virtual double area();
  virtual double perimeter();
};

class Square : public Shape {
private:
  double width;
public:
  Square(double w) : width(w) { }
  virtual double area();
  virtual double perimeter();
};

class IEsunnyQuotClient
{
public:
    /**
    *连接行情数据服务器IP及端口
    * @param ip 服务器的IP
    * @param port 服务器的端口
    * @return 0表示连接成功,否则失败
    */
    virtual int Connect(const char *ip,int port)=0;

    /**
    *断开当前连接
    */
    virtual void DisConnect()=0;
};

class IEsunnyQuotNotify
{
public:
    /**
    *登录反馈回调函数
    * @param err 错误号 0表示登录成功,否则失败
    * @param errtext 错误信息
    * @return 0表示成功,否则失败
    */
    virtual int OnRspLogin(int err,const char *errtext)=0;
};

//创建接口指针(使用前调用)
IEsunnyQuotClient * CreateEsunnyQuotClient(IEsunnyQuotNotify * notify);


/* setup.py */

from distutils.core import setup, Extension


example_module = Extension('_example',
                           libraries = ['example'],
                           sources=['example_wrap.cxx'],
                           )

setup (name = 'example',
       version = '0.1',
       author      = "SWIG Docs",
       description = """example wrap with swig""",
       ext_modules = [example_module],
       py_modules = ["example"],
       )

/* TestExample.py */

 #from EsunnyQuot import IEsunnyQuotClient, IEsunnyQuotNotify, CreateEsunnyQuotClient, DelEsunnyQuotClient
from example import IEsunnyQuotClient, IEsunnyQuotNotify, CreateEsunnyQuotClient

class EsunnyQuotNoify(IEsunnyQuotNotify):

    def __init__(self, *args, **kwargs):
        pass


class EsunnyQuotClient(IEsunnyQuotClient):

    def __init__(self):
        pass

client = None
try:
    notify = EsunnyQuotNoify() 
    print type(notify)
    client = CreateEsunnyQuotClient(notify)
finally:
    if client is not None:
        #DelEsunnyQuotClient(client)
        pass

2个回答

python调用Windows下的DLL文件标准做法就是使用ctypes库,功能很强大。主要是注意一下DLL的类型(cdll,windll,oledll)以及python类型与c类型的对应关系。函数传参时如果形参为指针,则可以使用byref获取某个变量的指针

hijack00
hijack00 应该可以吧。我利用ctypes封装libeng.dll的时候也会返回一个全局指针,我把它转换为一个普通的整型数保存起来,以后调用其它函数需要用到这个指针时再把这个整型数传进去。这样是可行的(不过我觉得这应该不是最完美的方法)
3 年多之前 回复
mmmaaaggg
mmmaaaggg 回复hijack00: 我想问一下,这种逻辑用ctypes能否实现:我需要继承dll接口里面 IEsunnyQuotNotify 类,并且将这个类作为指针参数传递给 CreateEsunnyQuotClient,来创建一个client实力。实例调用过程中。IEsunnyQuotNotify的接口函数其实就是一连串的回调函数来实现具体的数据交互操作。这样的逻辑,ctypes可是实现么?是否感谢
3 年多之前 回复
hijack00
hijack00 我也用swig封装过DLL,你可以看看我这篇博客:http://blog.csdn.net/hijack00/article/details/52224127
3 年多之前 回复
mmmaaaggg
mmmaaaggg 我感觉 SWIG 用起来应该更方便吧。不需要自己做个中调用、类型转换之类的东西,工具自动给封装好了。不过就是不知道为什么,调用起来这么费劲。另外,这个东西以后也会迁移到CentOS上面的。这方面,使用SWIG会有问题么?
3 年多之前 回复

暂时还没有人能帮我解决啊
我自己重新用C++包装了一遍DLL,然后把这个技术问题给绕过去了

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
SWIG 3.0+Python 2.7 报错:TypeError in method ... 求指点
最近需要用Python调用一个C++写的DLL接口,总是出问题于是做了一个小测试,发现有一个类初始化始终报错。 Python调用Dll接口中一个CreateEsunnyQuotClient 初始化方法 传递参数 IEsunnyQuotNotify * 的时候,出现错误,看起来是要传递一个指针变量,但是Python没有指针啊?直接使用ctypes 应该也不对吧,实在不解了。 TypeError: in method 'CreateEsunnyQuotClient', argument 1 of type 'IEsunnyQuotNotify * ' 具体错误信息如图: ![图片说明](https://img-ask.csdn.net/upload/201609/23/1474601335_258908.png) 下面是我做的一些测试用的文件:头文件 example.h、C++文件 example.cpp、SWIG接口文件 example.i、distutils安装文件 setup.py、测试文件 TestExample.py、 我用的环境是Python 2.7 32位、VS2015(2010也可以) 希望高人指点,已经忙了3天3夜了还是没有结果。十分感谢。 -------------------------------------------------------------------------------- /* example.h */ ``` class IEsunnyQuotNotify { public: /** *登录反馈回调函数 * @param err 错误号 0表示登录成功,否则失败 * @param errtext 错误信息 * @return 0表示成功,否则失败 */ virtual int OnRspLogin(int err,const char *errtext)=0; }; //创建接口指针(使用前调用) IEsunnyQuotClient * CreateEsunnyQuotClient(IEsunnyQuotNotify * notify); //释放接口指针(使用后调用) void DelEsunnyQuotClient(IEsunnyQuotClient * client); ``` -------------------------------------------------------------------------------- /* example.cpp */ ``` int IEsunnyQuotClient::Connect(const char *ip, int port) { return 0; } void IEsunnyQuotClient::DisConnect() { return; } class EsunnyQuotClient : public IEsunnyQuotClient { int Connect(const char *ip, int port) { return 0; }; void DisConnect() { return ; }; }; int IEsunnyQuotNotify::OnRspLogin(int err, const char *errtext) { return 0; } IEsunnyQuotClient * CreateEsunnyQuotClient(IEsunnyQuotNotify * notify) { return &EsunnyQuotClient(); } ``` -------------------------------------------------------------------------------- /* example.i*/ ``` /* File : example.i */ %module example %{ #include "example.h" %} class Shape { public: Shape() { nshapes++; } virtual ~Shape() { nshapes--; } double x, y; void move(double dx, double dy); virtual double area() = 0; virtual double perimeter() = 0; static int nshapes; }; class Circle : public Shape { private: double radius; public: Circle(double r) : radius(r) { } virtual double area(); virtual double perimeter(); }; class Square : public Shape { private: double width; public: Square(double w) : width(w) { } virtual double area(); virtual double perimeter(); }; class IEsunnyQuotClient { public: /** *连接行情数据服务器IP及端口 * @param ip 服务器的IP * @param port 服务器的端口 * @return 0表示连接成功,否则失败 */ virtual int Connect(const char *ip,int port)=0; /** *断开当前连接 */ virtual void DisConnect()=0; }; class IEsunnyQuotNotify { public: /** *登录反馈回调函数 * @param err 错误号 0表示登录成功,否则失败 * @param errtext 错误信息 * @return 0表示成功,否则失败 */ virtual int OnRspLogin(int err,const char *errtext)=0; }; //创建接口指针(使用前调用) IEsunnyQuotClient * CreateEsunnyQuotClient(IEsunnyQuotNotify * notify); ``` -------------------------------------------------------------------------------- /* setup.py */ ``` from distutils.core import setup, Extension example_module = Extension('_example', libraries = ['example'], sources=['example_wrap.cxx'], ) setup (name = 'example', version = '0.1', author = "SWIG Docs", description = """example wrap with swig""", ext_modules = [example_module], py_modules = ["example"], ) ``` -------------------------------------------------------------------------------- /* TestExample.py */ ``` #from EsunnyQuot import IEsunnyQuotClient, IEsunnyQuotNotify, CreateEsunnyQuotClient, DelEsunnyQuotClient from example import IEsunnyQuotClient, IEsunnyQuotNotify, CreateEsunnyQuotClient class EsunnyQuotNoify(IEsunnyQuotNotify): def __init__(self, *args, **kwargs): pass class EsunnyQuotClient(IEsunnyQuotClient): def __init__(self): pass client = None try: notify = EsunnyQuotNoify() print type(notify) client = CreateEsunnyQuotClient(notify) finally: if client is not None: #DelEsunnyQuotClient(client) pass ```
python2.7安装sklearn报错:ImportError: DLL load failed
import sklearn 报错: Traceback (most recent call last): File "<pyshell#3>", line 1, in <module> import sklearn File "D:\Python27\lib\site-packages\scikit_learn-0.15.2-py2.7-win-amd64.egg\sklearn\__init__.py", line 38, in <module> from .base import clone File "D:\Python27\lib\site-packages\scikit_learn-0.15.2-py2.7-win-amd64.egg\sklearn\base.py", line 10, in <module> from scipy import sparse File "D:\Python27\lib\site-packages\scipy\sparse\__init__.py", line 182, in <module> from .csr import * File "D:\Python27\lib\site-packages\scipy\sparse\csr.py", line 15, in <module> from .sparsetools import csr_tocsc, csr_tobsr, csr_count_blocks, \ File "D:\Python27\lib\site-packages\scipy\sparse\sparsetools\__init__.py", line 5, in <module> from .csr import * File "D:\Python27\lib\site-packages\scipy\sparse\sparsetools\csr.py", line 26, in <module> _csr = swig_import_helper() File "D:\Python27\lib\site-packages\scipy\sparse\sparsetools\csr.py", line 22, in swig_import_helper _mod = imp.load_module('_csr', fp, pathname, description) ImportError: DLL load failed: %1 不是有效的 Win32 应用程序。 用的python2.7.9,我已经安装了numpy1.9.1,scipy0.12.0,sklearn0.15.1,这些都是支持64位系统的,遇到这个问题我该怎么办
但是import tensorflow 会报错:Failed to load the native TensorFlow runtime
C:\ProgramData\Anaconda3\python.exe C:/Users/Administrator/PycharmProjects/untitled3/pppp.py Traceback (most recent call last): File "C:\ProgramData\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in <module> from tensorflow.python.pywrap_tensorflow_internal import * File "C:\ProgramData\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 28, in <module> _pywrap_tensorflow_internal = swig_import_helper() File "C:\ProgramData\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 24, in swig_import_helper _mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description) File "C:\ProgramData\Anaconda3\lib\imp.py", line 242, in load_module return load_dynamic(name, filename, file) File "C:\ProgramData\Anaconda3\lib\imp.py", line 342, in load_dynamic return _load(spec) ImportError: DLL load failed with error code -1073741795 During handling of the above exception, another exception occurred: Traceback (most recent call last): File "C:/Users/Administrator/PycharmProjects/untitled3/pppp.py", line 1, in <module> import tensorflow as tf File "C:\ProgramData\Anaconda3\lib\site-packages\tensorflow\__init__.py", line 24, in <module> from tensorflow.python import pywrap_tensorflow # pylint: disable=unused-import File "C:\ProgramData\Anaconda3\lib\site-packages\tensorflow\python\__init__.py", line 49, in <module> from tensorflow.python import pywrap_tensorflow File "C:\ProgramData\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 74, in <module> raise ImportError(msg) ImportError: Traceback (most recent call last): File "C:\ProgramData\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in <module> from tensorflow.python.pywrap_tensorflow_internal import * File "C:\ProgramData\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 28, in <module> _pywrap_tensorflow_internal = swig_import_helper() File "C:\ProgramData\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 24, in swig_import_helper _mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description) File "C:\ProgramData\Anaconda3\lib\imp.py", line 242, in load_module return load_dynamic(name, filename, file) File "C:\ProgramData\Anaconda3\lib\imp.py", line 342, in load_dynamic return _load(spec) ImportError: DLL load failed with error code -1073741795 Failed to load the native TensorFlow runtime. See https://www.tensorflow.org/install/errors for some common reasons and solutions. Include the entire stack trace above this error message when asking for help. Process finished with exit code 1
import tensorflow 时报错:version GLIBC_2.14 not found
**Linux下使用 pip install tensorflow --upgrade 命令安装成功,但是在import tensorflow的时候报错,具体错误如下: ** >>> import tensorflow Traceback (most recent call last): File "/usr/local/lib/python3.5/site-packages/tensorflow/python/pywrap_tensorflow.py", line 41, in <module> from tensorflow.python.pywrap_tensorflow_internal import * File "/usr/local/lib/python3.5/site-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 28, in <module> _pywrap_tensorflow_internal = swig_import_helper() File "/usr/local/lib/python3.5/site-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 24, in swig_import_helper _mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description) File "/usr/local/lib/python3.5/imp.py", line 242, in load_module return load_dynamic(name, filename, file) File "/usr/local/lib/python3.5/imp.py", line 342, in load_dynamic return _load(spec) ImportError: /usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.18' not found (required by /usr/local/lib/python3.5/site-packages/tensorflow/python/_pywrap_tensorflow_internal.so) During handling of the above exception, another exception occurred: Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/usr/local/lib/python3.5/site-packages/tensorflow/__init__.py", line 24, in <module> from tensorflow.python import * File "/usr/local/lib/python3.5/site-packages/tensorflow/python/__init__.py", line 49, in <module> from tensorflow.python import pywrap_tensorflow File "/usr/local/lib/python3.5/site-packages/tensorflow/python/pywrap_tensorflow.py", line 52, in <module> raise ImportError(msg) ImportError: Traceback (most recent call last): File "/usr/local/lib/python3.5/site-packages/tensorflow/python/pywrap_tensorflow.py", line 41, in <module> from tensorflow.python.pywrap_tensorflow_internal import * File "/usr/local/lib/python3.5/site-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 28, in <module> _pywrap_tensorflow_internal = swig_import_helper() File "/usr/local/lib/python3.5/site-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 24, in swig_import_helper _mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description) File "/usr/local/lib/python3.5/imp.py", line 242, in load_module return load_dynamic(name, filename, file) File "/usr/local/lib/python3.5/imp.py", line 342, in load_dynamic return _load(spec) ImportError: /usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.18' not found (required by /usr/local/lib/python3.5/site-packages/tensorflow/python/_pywrap_tensorflow_internal.so) Failed to load the native TensorFlow runtime. See https://www.tensorflow.org/install/install_sources#common_installation_problems for some common reasons and solutions. Include the entire stack trace above this error message when asking for help. **最开始是 version 'GLIBC2.14' not found,升级到glibc2.14版本后,又报错 version ‘GLIBC2.18’not found,又升级到2.19版本就报现在这个错误,这真是由于GLIBC版本过低引起的吗,怎么解决?**
Centos6.4 安装完tensorflow后 命令行输入 import tensorflow报错
小弟刚刚接触tensorflow,照的网上的教程安装完之后,在命令行运行import tensorflow这条语句的时候就报错了,下面是报错的内容,希望各位大神帮帮小弟。 >>> import tensorflow Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/home/anaconda2/envs/tensorflow/lib/python2.7/site-packages/tensorflow/__init__.py", line 24, in <module> from tensorflow.python import * File "/home/anaconda2/envs/tensorflow/lib/python2.7/site-packages/tensorflow/python/__init__.py", line 49, in <module> from tensorflow.python import pywrap_tensorflow File "/home/anaconda2/envs/tensorflow/lib/python2.7/site-packages/tensorflow/python/pywrap_tensorflow.py", line 72, in <module> raise ImportError(msg) ImportError: Traceback (most recent call last): File "/home/anaconda2/envs/tensorflow/lib/python2.7/site-packages/tensorflow/python/pywrap_tensorflow.py", line 58, in <module> from tensorflow.python.pywrap_tensorflow_internal import * File "/home/anaconda2/envs/tensorflow/lib/python2.7/site-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 28, in <module> _pywrap_tensorflow_internal = swig_import_helper() File "/home/anaconda2/envs/tensorflow/lib/python2.7/site-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 24, in swig_import_helper _mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description) ImportError: /lib64/libc.so.6: version `GLIBC_2.16' not found (required by /home/zhufeng/anaconda2/envs/tensorflow/lib/python2.7/site-packages/tensorflow/python/_pywrap_tensorflow_internal.so) Failed to load the native TensorFlow runtime. See https://www.tensorflow.org/install/install_sources#common_installation_problems for some common reasons and solutions. Include the entire stack trace above this error message when asking for help.
怎样正确在pycharm运行tensorflow-gpu
我在网上尝试寻找正确安装与运行tensorflow-gpu的方法。 最终卡在了无法导入tensorflow,但是却可以.出联想方法,求助。 ![图片说明](https://img-ask.csdn.net/upload/201909/27/1569546276_565168.png) 全部报错如下: Traceback (most recent call last): File "C:\Users\machenike\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in <module> from tensorflow.python.pywrap_tensorflow_internal import * File "C:\Users\machenike\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 28, in <module> _pywrap_tensorflow_internal = swig_import_helper() File "C:\Users\machenike\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 24, in swig_import_helper _mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description) File "C:\Users\machenike\Anaconda3\lib\imp.py", line 242, in load_module return load_dynamic(name, filename, file) File "C:\Users\machenike\Anaconda3\lib\imp.py", line 342, in load_dynamic return _load(spec) ImportError: DLL load failed: 找不到指定的模块。 During handling of the above exception, another exception occurred: Traceback (most recent call last): File "D:/PycharmProjects/DeepLearning2/demo.py", line 1, in <module> import tensorflow File "C:\Users\machenike\Anaconda3\lib\site-packages\tensorflow\__init__.py", line 28, in <module> from tensorflow.python import pywrap_tensorflow # pylint: disable=unused-import File "C:\Users\machenike\Anaconda3\lib\site-packages\tensorflow\python\__init__.py", line 49, in <module> from tensorflow.python import pywrap_tensorflow File "C:\Users\machenike\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 74, in <module> raise ImportError(msg) ImportError: Traceback (most recent call last): File "C:\Users\machenike\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in <module> from tensorflow.python.pywrap_tensorflow_internal import * File "C:\Users\machenike\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 28, in <module> _pywrap_tensorflow_internal = swig_import_helper() File "C:\Users\machenike\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 24, in swig_import_helper _mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description) File "C:\Users\machenike\Anaconda3\lib\imp.py", line 242, in load_module return load_dynamic(name, filename, file) File "C:\Users\machenike\Anaconda3\lib\imp.py", line 342, in load_dynamic return _load(spec) ImportError: DLL load failed: 找不到指定的模块。 Failed to load the native TensorFlow runtime. See https://www.tensorflow.org/install/errors for some common reasons and solutions. Include the entire stack trace above this error message when asking for help.
利用conda install TensorFlow-gpu在win7上conda3.7版本上安装tensorflow后,测试时出现下面的问题
在测试import TensorFlow as tf print('hello'),出现下列问题,请问这是什么原因造成的,如何改? ``` Traceback (most recent call last): File "D:\ProgramData\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in <module> from tensorflow.python.pywrap_tensorflow_internal import * File "D:\Program Files\JetBrains\PyCharm 2019.1.3\helpers\pydev\_pydev_bundle\pydev_import_hook.py", line 21, in do_import module = self._system_import(name, *args, **kwargs) File "D:\ProgramData\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 28, in <module> _pywrap_tensorflow_internal = swig_import_helper() File "D:\ProgramData\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 24, in swig_import_helper _mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description) File "D:\ProgramData\Anaconda3\lib\imp.py", line 242, in load_module return load_dynamic(name, filename, file) File "D:\ProgramData\Anaconda3\lib\imp.py", line 342, in load_dynamic return _load(spec) ImportError: DLL load failed: 找不到指定的程序。 During handling of the above exception, another exception occurred: Traceback (most recent call last): File "D:\ProgramData\Anaconda3\lib\site-packages\IPython\core\interactiveshell.py", line 3296, in run_code exec(code_obj, self.user_global_ns, self.user_ns) File "<ipython-input-2-d1ce02c95f3b>", line 1, in <module> runfile('C:/Users/jianjiu17/Desktop/deep-learning-from-scratch-master/uittle.py', wdir='C:/Users/jianjiu17/Desktop/deep-learning-from-scratch-master') File "D:\Program Files\JetBrains\PyCharm 2019.1.3\helpers\pydev\_pydev_bundle\pydev_umd.py", line 197, in runfile pydev_imports.execfile(filename, global_vars, local_vars) # execute the script File "D:\Program Files\JetBrains\PyCharm 2019.1.3\helpers\pydev\_pydev_imps\_pydev_execfile.py", line 18, in execfile exec(compile(contents+"\n", file, 'exec'), glob, loc) File "C:/Users/jianjiu17/Desktop/deep-learning-from-scratch-master/uittle.py", line 1, in <module> import tensorflow as tf File "D:\Program Files\JetBrains\PyCharm 2019.1.3\helpers\pydev\_pydev_bundle\pydev_import_hook.py", line 21, in do_import module = self._system_import(name, *args, **kwargs) File "D:\ProgramData\Anaconda3\lib\site-packages\tensorflow\__init__.py", line 24, in <module> from tensorflow.python import pywrap_tensorflow # pylint: disable=unused-import File "D:\Program Files\JetBrains\PyCharm 2019.1.3\helpers\pydev\_pydev_bundle\pydev_import_hook.py", line 21, in do_import module = self._system_import(name, *args, **kwargs) File "D:\ProgramData\Anaconda3\lib\site-packages\tensorflow\python\__init__.py", line 49, in <module> from tensorflow.python import pywrap_tensorflow File "D:\Program Files\JetBrains\PyCharm 2019.1.3\helpers\pydev\_pydev_bundle\pydev_import_hook.py", line 21, in do_import module = self._system_import(name, *args, **kwargs) File "D:\ProgramData\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 74, in <module> raise ImportError(msg) ImportError: Traceback (most recent call last): File "D:\ProgramData\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in <module> from tensorflow.python.pywrap_tensorflow_internal import * File "D:\Program Files\JetBrains\PyCharm 2019.1.3\helpers\pydev\_pydev_bundle\pydev_import_hook.py", line 21, in do_import module = self._system_import(name, *args, **kwargs) File "D:\ProgramData\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 28, in <module> _pywrap_tensorflow_internal = swig_import_helper() File "D:\ProgramData\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 24, in swig_import_helper _mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description) File "D:\ProgramData\Anaconda3\lib\imp.py", line 242, in load_module return load_dynamic(name, filename, file) File "D:\ProgramData\Anaconda3\lib\imp.py", line 342, in load_dynamic return _load(spec) ImportError: DLL load failed: 找不到指定的程序。 Failed to load the native TensorFlow runtime. See https://www.tensorflow.org/install/errors for some common reasons and solutions. Include the entire stack trace above this error message when asking for help. ```
安装 tensorflow cpu 版出问题, 求解决办法。 谢谢
安装 tensorflow cpu 版出问题, 求解决办法。 谢谢 Windows 10 64bits, anaconda-3.4.2(Python3.5.2), tensorflow version 1.11-0, 第一次运行时报错: ImportError: DLL load failed: 动态链接库(DLL)初始化例程失败。 Environment parameter path: C:\Program Files\Microsoft MPI\Bin\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\CUDA\bin64;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\dotnet\;C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v6.5\lib\x64;C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v6.5\extras\CUPTI\libx64;C:\Program Files\Microsoft VS Code;C:\Program Files\Anaconda3;C:\Program Files\Anaconda3\Scripts;C:\Program Files\Anaconda3\Library\bin; MSVCP140.DLL在以下2个目录 C:\Program Files\Anaconda3 C:\Program Files\Anaconda3\Library\bin C:\Windows\system32>python Python 3.5.2 |Anaconda 4.2.0 (64-bit)| (default, Jul 5 2016, 11:41:13) [MSC v.1900 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> C:\Windows\system32>pip install tensorflow Collecting tensorflow Using cached https://files.pythonhosted.org/packages/af/5b/695e2e66feb27742a78f938d8369cc874b5fc7082193c3352c9db599af01/tensorflow-1.11.0-cp35-cp35m-win_amd64.whl Requirement already satisfied: grpcio>=1.8.6 in c:\program files\anaconda3\lib\site-packages (from tensorflow) (1.16.0) Requirement already satisfied: astor>=0.6.0 in c:\program files\anaconda3\lib\site-packages (from tensorflow) (0.7.1) Requirement already satisfied: numpy>=1.13.3 in c:\program files\anaconda3\lib\site-packages (from tensorflow) (1.15.3) Requirement already satisfied: keras-applications>=1.0.5 in c:\program files\anaconda3\lib\site-packages (from tensorflow) (1.0.6) Requirement already satisfied: absl-py>=0.1.6 in c:\program files\anaconda3\lib\site-packages (from tensorflow) (0.6.1) Requirement already satisfied: six>=1.10.0 in c:\program files\anaconda3\lib\site-packages (from tensorflow) (1.10.0) Requirement already satisfied: setuptools<=39.1.0 in c:\program files\anaconda3\lib\site-packages\setuptools-27.2.0-py3.5.egg (from tensorflow) (27.2.0) Requirement already satisfied: protobuf>=3.6.0 in c:\program files\anaconda3\lib\site-packages (from tensorflow) (3.6.1) Requirement already satisfied: keras-preprocessing>=1.0.3 in c:\program files\anaconda3\lib\site-packages (from tensorflow) (1.0.5) Requirement already satisfied: termcolor>=1.1.0 in c:\program files\anaconda3\lib\site-packages (from tensorflow) (1.1.0) Requirement already satisfied: gast>=0.2.0 in c:\program files\anaconda3\lib\site-packages (from tensorflow) (0.2.0) Requirement already satisfied: wheel>=0.26 in c:\program files\anaconda3\lib\site-packages (from tensorflow) (0.29.0) Requirement already satisfied: tensorboard<1.12.0,>=1.11.0 in c:\program files\anaconda3\lib\site-packages (from tensorflow) (1.11.0) Requirement already satisfied: h5py in c:\program files\anaconda3\lib\site-packages (from keras-applications>=1.0.5->tensorflow) (2.6.0) Requirement already satisfied: markdown>=2.6.8 in c:\program files\anaconda3\lib\site-packages (from tensorboard<1.12.0,>=1.11.0->tensorflow) (3.0.1) Requirement already satisfied: werkzeug>=0.11.10 in c:\program files\anaconda3\lib\site-packages (from tensorboard<1.12.0,>=1.11.0->tensorflow) (0.11.11) Installing collected packages: tensorflow Successfully installed tensorflow-1.11.0 错误信息: --------------------------------------------------------------------------- ImportError Traceback (most recent call last) C:\Program Files\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow.py in <module>() 57 ---> 58 from tensorflow.python.pywrap_tensorflow_internal import * 59 from tensorflow.python.pywrap_tensorflow_internal import __version__ C:\Program Files\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py in <module>() 27 return _mod ---> 28 _pywrap_tensorflow_internal = swig_import_helper() 29 del swig_import_helper C:\Program Files\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py in swig_import_helper() 23 try: ---> 24 _mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description) 25 finally: C:\Program Files\Anaconda3\lib\imp.py in load_module(name, file, filename, details) 241 else: --> 242 return load_dynamic(name, filename, file) 243 elif type_ == PKG_DIRECTORY: C:\Program Files\Anaconda3\lib\imp.py in load_dynamic(name, path, file) 341 name=name, loader=loader, origin=path) --> 342 return _load(spec) 343 ImportError: DLL load failed: 动态链接库(DLL)初始化例程失败。 During handling of the above exception, another exception occurred: ImportError Traceback (most recent call last) <ipython-input-1-41389fad42b5> in <module>() ----> 1 import tensorflow as tf C:\Program Files\Anaconda3\lib\site-packages\tensorflow\__init__.py in <module>() 20 21 # pylint: disable=g-bad-import-order ---> 22 from tensorflow.python import pywrap_tensorflow # pylint: disable=unused-import 23 24 try: C:\Program Files\Anaconda3\lib\site-packages\tensorflow\python\__init__.py in <module>() 47 import numpy as np 48 ---> 49 from tensorflow.python import pywrap_tensorflow 50 51 # Protocol buffers C:\Program Files\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow.py in <module>() 72 for some common reasons and solutions. Include the entire stack trace 73 above this error message when asking for help.""" % traceback.format_exc() ---> 74 raise ImportError(msg) 75 76 # pylint: enable=wildcard-import,g-import-not-at-top,unused-import,line-too-long ImportError: Traceback (most recent call last): File "C:\Program Files\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in <module> from tensorflow.python.pywrap_tensorflow_internal import * File "C:\Program Files\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 28, in <module> _pywrap_tensorflow_internal = swig_import_helper() File "C:\Program Files\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 24, in swig_import_helper _mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description) File "C:\Program Files\Anaconda3\lib\imp.py", line 242, in load_module return load_dynamic(name, filename, file) File "C:\Program Files\Anaconda3\lib\imp.py", line 342, in load_dynamic return _load(spec) ImportError: DLL load failed: 动态链接库(DLL)初始化例程失败。 Failed to load the native TensorFlow runtime. See https://www.tensorflow.org/install/install_sources#common_installation_problems for some common reasons and solutions. Include the entire stack trace above this error message when asking for help.
Hexo nexT主题博客,搭建遇到错误
搭建博客,配置部署的时候我遇到了点问题 ``` ERROR Process failed: layout/_macro/post.swig Error: SyntaxError: Unexpected token || in file E:\BlogRepos\themes\next\layout\_macro\post.swig. at Object.exports.throwError (E:\BlogRepos\node_modules\swig-templates\lib\utils.js:188:9) at exports.Swig.precompile (E:\BlogRepos\node_modules\swig-templates\lib\swig.js:550:13) at Object.compile (E:\BlogRepos\node_modules\swig-templates\lib\swig.js:651:16) at Function.swigRenderer.compile (E:\BlogRepos\node_modules\hexo\lib\plugins\renderer\swig.js:41:47) at Theme._View.View.View._precompile (E:\BlogRepos\node_modules\hexo\lib\theme\view.js:116:31) at Theme._View.View.View (E:\BlogRepos\node_modules\hexo\lib\theme\view.js:14:8) at new Theme._View.View (E:\BlogRepos\node_modules\hexo\lib\theme\index.js:37:13) at Theme.setView (E:\BlogRepos\node_modules\hexo\lib\theme\index.js:71:16) at file.read.then.result (E:\BlogRepos\node_modules\hexo\lib\theme\processors\view.js:14:14) at tryCatcher (E:\BlogRepos\node_modules\bluebird\js\release\util.js:16:23) at Promise._settlePromiseFromHandler (E:\BlogRepos\node_modules\bluebird\js\release\promise.js:517:31) at Promise._settlePromise (E:\BlogRepos\node_modules\bluebird\js\release\promise.js:574:18) at Promise._settlePromise0 (E:\BlogRepos\node_modules\bluebird\js\release\promise.js:619:10) at Promise._settlePromises (E:\BlogRepos\node_modules\bluebird\js\release\promise.js:699:18) at Promise._fulfill (E:\BlogRepos\node_modules\bluebird\js\release\promise.js:643:18) at Promise._resolveCallback (E:\BlogRepos\node_modules\bluebird\js\release\promise.js:437:57) at Promise._settlePromiseFromHandler (E:\BlogRepos\node_modules\bluebird\js\release\promise.js:529:17) at Promise._settlePromise (E:\BlogRepos\node_modules\bluebird\js\release\promise.js:574:18) at Promise._settlePromise0 (E:\BlogRepos\node_modules\bluebird\js\release\promise.js:619:10) at Promise._settlePromises (E:\BlogRepos\node_modules\bluebird\js\release\promise.js:699:18) at Promise._fulfill (E:\BlogRepos\node_modules\bluebird\js\release\promise.js:643:18) at E:\BlogRepos\node_modules\bluebird\js\release\nodeback.js:42:21 ``` 希望大佬帮我看看
python3下安装tensorflow,感觉安装成功了可是总是有奇怪的东西跑出来?
已安装python3.6,现在安装tensorflow,下好安装包,放在python的scripts文件夹中。 在cmd中输入pip install tensorflow回车(尝试了好几次)。出现下面的数据: Microsoft Windows [版本 10.0.17134.285] (c) 2018 Microsoft Corporation。保留所有权利。 C:\Users\lenovo>pip install tensorflow Requirement already satisfied: tensorflow in c:\users\lenovo\appdata\local\programs\python\python36\lib\site-packages Requirement already satisfied: numpy>=1.13.3 in c:\users\lenovo\appdata\local\programs\python\python36\lib\site-packages (from tensorflow) Requirement already satisfied: tensorboard<1.12.0,>=1.11.0 in c:\users\lenovo\appdata\local\programs\python\python36\lib\site-packages (from tensorflow) Requirement already satisfied: termcolor>=1.1.0 in c:\users\lenovo\appdata\local\programs\python\python36\lib\site-packages (from tensorflow) Requirement already satisfied: six>=1.10.0 in c:\users\lenovo\appdata\local\programs\python\python36\lib\site-packages (from tensorflow) Requirement already satisfied: astor>=0.6.0 in c:\users\lenovo\appdata\local\programs\python\python36\lib\site-packages (from tensorflow) Requirement already satisfied: grpcio>=1.8.6 in c:\users\lenovo\appdata\local\programs\python\python36\lib\site-packages (from tensorflow) Requirement already satisfied: protobuf>=3.6.0 in c:\users\lenovo\appdata\local\programs\python\python36\lib\site-packages (from tensorflow) Requirement already satisfied: setuptools<=39.1.0 in c:\users\lenovo\appdata\local\programs\python\python36\lib\site-packages (from tensorflow) Requirement already satisfied: wheel>=0.26 in c:\users\lenovo\appdata\local\programs\python\python36\lib\site-packages (from tensorflow) Requirement already satisfied: absl-py>=0.1.6 in c:\users\lenovo\appdata\local\programs\python\python36\lib\site-packages (from tensorflow) Requirement already satisfied: keras-preprocessing>=1.0.3 in c:\users\lenovo\appdata\local\programs\python\python36\lib\site-packages (from tensorflow) Requirement already satisfied: keras-applications>=1.0.5 in c:\users\lenovo\appdata\local\programs\python\python36\lib\site-packages (from tensorflow) Requirement already satisfied: gast>=0.2.0 in c:\users\lenovo\appdata\local\programs\python\python36\lib\site-packages (from tensorflow) Requirement already satisfied: markdown>=2.6.8 in c:\users\lenovo\appdata\local\programs\python\python36\lib\site-packages (from tensorboard<1.12.0,>=1.11.0->tensorflow) Requirement already satisfied: werkzeug>=0.11.10 in c:\users\lenovo\appdata\local\programs\python\python36\lib\site-packages (from tensorboard<1.12.0,>=1.11.0->tensorflow) Requirement already satisfied: h5py in c:\users\lenovo\appdata\local\programs\python\python36\lib\site-packages (from keras-applications>=1.0.5->tensorflow) You are using pip version 9.0.1, however version 18.0 is available. You should consider upgrading via the 'python -m pip install --upgrade pip' command. C:\Users\lenovo> 我看出现Requirement already satisfied: tensorflow in c:\users\lenovo\appdata\local\programs\python\python36\lib\site-packages 不是就是安装成功了吗? 可是我在调用的时候又出现了这个: =================== RESTART: D:\python-files\keras\num.py =================== Using TensorFlow backend. Traceback (most recent call last): File "C:\Users\lenovo\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in <module> from tensorflow.python.pywrap_tensorflow_internal import * File "C:\Users\lenovo\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 28, in <module> _pywrap_tensorflow_internal = swig_import_helper() File "C:\Users\lenovo\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 24, in swig_import_helper _mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description) File "C:\Users\lenovo\AppData\Local\Programs\Python\Python36\lib\imp.py", line 243, in load_module return load_dynamic(name, filename, file) File "C:\Users\lenovo\AppData\Local\Programs\Python\Python36\lib\imp.py", line 343, in load_dynamic return _load(spec) ImportError: DLL load failed: 动态链接库(DLL)初始化例程失败。 反正就是又失败了。 所以我这个tensorflow是安装成功了还是失败了?为什么会这样嘞?
python通过swig实现的C语言接口传递指针时是如何工作的?
我最近在尝试使用swig生成一个c语言项目的python接口,但是碰到一些指针传递的问题。以下是我的代码: ``` // swig_test.c POINT *test() { POINT point; point.x = 5; point.y = 2; //int r = point.x%point.y; printf("test\n"); printf("point.x: %d, %d\n", point.x, &(point.x)); printf("point.y: %d\n", point.y); printf("&point: %d\n\n", &point); return &point; } int test2(POINT *p) { POINT point = *p; printf("p: %d, %d, %d\n", p, (*p).x, (*p).y); printf("test2\n"); printf("point.x: %d, %d\n", (*p).x, point.x); printf("point.y: %d, %d\n", (*p).y, point.y); printf("point.x: %d\n", point.x); printf("point.y: %d\n", point.y); int r = 1; //point.x% point.y; return r; } int main() { POINT *p = test(); int r = test2(p); printf("%d", r); } // swig_test.h #include <stdio.h> #include <string.h> struct POINT; typedef struct POINT POINT; struct POINT { unsigned int x; unsigned int y; }; POINT *test(); int test2(POINT *p); // swig_test.i %module swig_test %{ /* Put header files here or function declarations like below */ #include "swig_test.h" extern POINT *test(); extern int test2(POINT *p); %} %include "swig_test.h" extern POINT* test(); extern int test2(POINT* p); // main.py import _swig_test as module global point point = module.test() print(module.test2(point)) ``` 当我只运行C的可执行文件版本时,输出是正确的: ``` test point.x: 5, 2012281584 point.y: 2 &point: 2012281584 p: 2012281584, 5, 2 test2 point.x: 2012274424, 5 point.y: 0, 2 point.x: 5 point.y: 2 1 ``` 但是当我生成了pyd动态库并链接进python,指针传递进test2后所指向的值就发生了变化: ``` test point.x: 5, 666825456 point.y: 2 &point: 666825456 p: 666825456, 666825496, 119 test2 point.x: 666825496, 666825496 point.y: 119, 119 point.x: 666825496 point.y: 119 1 ``` 由命令行可见,被传递的指针本身没有变化,但是所指向的值变了,请问这是为什么?难道python在结束test之后,所有变量已经都被释放了?
    return load_dynamic(name, filename, file) tensorflow安装这个报错半年也没有解决
>>> import tensorflow as tf Traceback (most recent call last):   File "C:\Users\cheng\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in <module>     from tensorflow.python.pywrap_tensorflow_internal import *   File "C:\Users\cheng\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 28, in <module>     _pywrap_tensorflow_internal = swig_import_helper()   File "C:\Users\cheng\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 24, in swig_import_helper     _mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description)   File "C:\Users\cheng\AppData\Local\Programs\Python\Python36\lib\imp.py", line 243, in load_module     return load_dynamic(name, filename, file)   File "C:\Users\cheng\AppData\Local\Programs\Python\Python36\lib\imp.py", line 343, in load_dynamic     return _load(spec) ImportError: DLL load failed: 找不到指定的模块。 During handling of the above exception, another exception occurred: Traceback (most recent call last):   File "<stdin>", line 1, in <module>   File "C:\Users\cheng\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\__init__.py", line 22, in <module>     from tensorflow.python import pywrap_tensorflow  # pylint: disable=unused-import   File "C:\Users\cheng\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\__init__.py", line 49, in <module>     from tensorflow.python import pywrap_tensorflow   File "C:\Users\cheng\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 74, in <module>     raise ImportError(msg) ImportError: Traceback (most recent call last):   File "C:\Users\cheng\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in <module>     from tensorflow.python.pywrap_tensorflow_internal import *   File "C:\Users\cheng\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 28, in <module>     _pywrap_tensorflow_internal = swig_import_helper()   File "C:\Users\cheng\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 24, in swig_import_helper     _mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description)   File "C:\Users\cheng\AppData\Local\Programs\Python\Python36\lib\imp.py", line 243, in load_module     return load_dynamic(name, filename, file)   File "C:\Users\cheng\AppData\Local\Programs\Python\Python36\lib\imp.py", line 343, in load_dynamic     return _load(spec) ImportError: DLL load failed: 找不到指定的模块。 安装报错 不要叫我退到安装1.5
ImportError: No module named '_pywrap_tensorflow_internal'
tensorflow==1.5.0 安装成功;继续安装gpu版本,按系统提示再安装 CUDA-9.0, cuDNN-7.0: cuda_9.0.176_win10_network以及patch1-4 / cudnn-9.0-windows10-x64-v7.3.1.20. 运行‘import tensorflow as tf’后报错: ImportError: No module named '_pywrap_tensorflow_internal' 谢谢帮助 --------------------------------------------------------------------------- ImportError Traceback (most recent call last) C:\Program Files\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py in swig_import_helper() 17 try: ---> 18 return importlib.import_module(mname) 19 except ImportError: C:\Program Files\Anaconda3\lib\importlib\__init__.py in import_module(name, package) 125 level += 1 --> 126 return _bootstrap._gcd_import(name[level:], package, level) 127 C:\Program Files\Anaconda3\lib\importlib\_bootstrap.py in _gcd_import(name, package, level) C:\Program Files\Anaconda3\lib\importlib\_bootstrap.py in _find_and_load(name, import_) C:\Program Files\Anaconda3\lib\importlib\_bootstrap.py in _find_and_load_unlocked(name, import_) C:\Program Files\Anaconda3\lib\importlib\_bootstrap.py in _load_unlocked(spec) C:\Program Files\Anaconda3\lib\importlib\_bootstrap.py in module_from_spec(spec) C:\Program Files\Anaconda3\lib\importlib\_bootstrap_external.py in create_module(self, spec) C:\Program Files\Anaconda3\lib\importlib\_bootstrap.py in _call_with_frames_removed(f, *args, **kwds) ImportError: DLL load failed: 找不到指定的程序。 During handling of the above exception, another exception occurred: ImportError Traceback (most recent call last) C:\Program Files\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow.py in <module>() 57 ---> 58 from tensorflow.python.pywrap_tensorflow_internal import * 59 from tensorflow.python.pywrap_tensorflow_internal import __version__ C:\Program Files\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py in <module>() 20 return importlib.import_module('_pywrap_tensorflow_internal') ---> 21 _pywrap_tensorflow_internal = swig_import_helper() 22 del swig_import_helper C:\Program Files\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py in swig_import_helper() 19 except ImportError: ---> 20 return importlib.import_module('_pywrap_tensorflow_internal') 21 _pywrap_tensorflow_internal = swig_import_helper() C:\Program Files\Anaconda3\lib\importlib\__init__.py in import_module(name, package) 125 level += 1 --> 126 return _bootstrap._gcd_import(name[level:], package, level) 127 ImportError: No module named '_pywrap_tensorflow_internal' During handling of the above exception, another exception occurred: ImportError Traceback (most recent call last) <ipython-input-1-41389fad42b5> in <module>() ----> 1 import tensorflow as tf C:\Program Files\Anaconda3\lib\site-packages\tensorflow\__init__.py in <module>() 22 23 # pylint: disable=wildcard-import ---> 24 from tensorflow.python import * 25 # pylint: enable=wildcard-import 26 C:\Program Files\Anaconda3\lib\site-packages\tensorflow\python\__init__.py in <module>() 47 import numpy as np 48 ---> 49 from tensorflow.python import pywrap_tensorflow 50 51 # Protocol buffers C:\Program Files\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow.py in <module>() 72 for some common reasons and solutions. Include the entire stack trace 73 above this error message when asking for help.""" % traceback.format_exc() ---> 74 raise ImportError(msg) 75 76 # pylint: enable=wildcard-import,g-import-not-at-top,unused-import,line-too-long ImportError: Traceback (most recent call last): File "C:\Program Files\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 18, in swig_import_helper return importlib.import_module(mname) File "C:\Program Files\Anaconda3\lib\importlib\__init__.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "<frozen importlib._bootstrap>", line 986, in _gcd_import File "<frozen importlib._bootstrap>", line 969, in _find_and_load File "<frozen importlib._bootstrap>", line 958, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 666, in _load_unlocked File "<frozen importlib._bootstrap>", line 577, in module_from_spec File "<frozen importlib._bootstrap_external>", line 906, in create_module File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed ImportError: DLL load failed: 找不到指定的程序。 During handling of the above exception, another exception occurred: Traceback (most recent call last): File "C:\Program Files\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in <module> from tensorflow.python.pywrap_tensorflow_internal import * File "C:\Program Files\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 21, in <module> _pywrap_tensorflow_internal = swig_import_helper() File "C:\Program Files\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 20, in swig_import_helper return importlib.import_module('_pywrap_tensorflow_internal') File "C:\Program Files\Anaconda3\lib\importlib\__init__.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) ImportError: No module named '_pywrap_tensorflow_internal' Failed to load the native TensorFlow runtime. See https://www.tensorflow.org/install/install_sources#common_installation_problems for some common reasons and solutions. Include the entire stack trace above this error message when asking for help.
运行pocketsphinxDemo,ndk-build出错,Error1
1. 在demo的jni 下运行ndk-build得到的部分错误信息: ```/home/nkumtl/workspace/ndk32/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld: /home/nkumtl/sphinx/demo/obj/local/armeabi/objs-debug/pocketsphinx_jni/pocketsphinx_wrap.o: in function ps_decoder_s_getHyp:/home/nkumtl/sphinx/demo/jni/pocketsphinx_wrap.c:874: error: undefined reference to 'new_Hypothesis' collect2: ld returned 1 exit status make: *** [/home/nkumtl/sphinx/demo/obj/local/armeabi/libpocketsphinx_jni.so] Error 1 ``` 本来在没有安装adt jdk之前(只有命令行安装的eclipse的时候)是没有报错的,安了以后就错了。error1到底是什么的错呢。 路径什么的都应该是没有错的,在Android.mk中需要改的两处也都改了。 2. 看有的大神说 这个问题 ``` undefined reference to 'new_Hypothesis' ``` 是swig版本的问题,我已经换了swig1.3.40,但还是没有用。 求帮助。。。 3. 还有想问一下打印出来的类似的 ```[armeabi] Compile thumb : pocketsphinx <= acmod.c [armeabi] Compile thumb : pocketsphinx <= bin_mdef.c [armeabi] Compile thumb : pocketsphinx <= blkarray_list.c [armeabi] Compile thumb : pocketsphinx <= dict.c [armeabi] Compile thumb : pocketsphinx <= dict2pid.c [armeabi] Compile thumb : pocketsphinx <= fsg_history.c [armeabi] Compile thumb : pocketsphinx <= fsg_lextree.c [armeabi] Compile thumb : pocketsphinx <= fsg_search.c [armeabi] Compile arm : pocketsphinx <= hmm.c [armeabi] Compile thumb : pocketsphinx <= mdef.c [armeabi] Compile arm : pocketsphinx <= ms_gauden.c [armeabi] Compile arm : pocketsphinx <= ms_mgau.c ``` 这些是错误吗?我有点迷惑这些是什么。
tensorflowGPU安装出现ImportError
win10+1080ti+CUDA9.0.176+cuDnn7.0.5+VS2015 使用anaconda3-5.1.0安装python版本为3.5.4,tensorflowGPU1.5, import tensorflow 出现如下错误。该如何解决? ImportError: DLL load failed: 找不到指定的模块。 ImportError: No module named '_pywrap_tensorflow_internal' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "<stdin>", line 1, in <module> File "D:\Programs\Anaconda3\envs\tensorflow_gpu\lib\site-packages\tensorflow\__init__.py", line 24, in <module> from tensorflow.python import * File "D:\Programs\Anaconda3\envs\tensorflow_gpu\lib\site-packages\tensorflow\python\__init__.py", line 49, in <module> from tensorflow.python import pywrap_tensorflow File "D:\Programs\Anaconda3\envs\tensorflow_gpu\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 74, in <module> raise ImportError(msg) ImportError: Traceback (most recent call last): File "D:\Programs\Anaconda3\envs\tensorflow_gpu\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 18, in swig_import_helper return importlib.import_module(mname) File "D:\Programs\Anaconda3\envs\tensorflow_gpu\lib\importlib\__init__.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "<frozen importlib._bootstrap>", line 985, in _gcd_import File "<frozen importlib._bootstrap>", line 968, in _find_and_load File "<frozen importlib._bootstrap>", line 957, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 666, in _load_unlocked File "<frozen importlib._bootstrap>", line 577, in module_from_spec File "<frozen importlib._bootstrap_external>", line 938, in create_module File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed ImportError: DLL load failed: 找不到指定的模块。 During handling of the above exception, another exception occurred: Traceback (most recent call last): File "D:\Programs\Anaconda3\envs\tensorflow_gpu\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in <module> from tensorflow.python.pywrap_tensorflow_internal import * File "D:\Programs\Anaconda3\envs\tensorflow_gpu\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 21, in <module> _pywrap_tensorflow_internal = swig_import_helper() File "D:\Programs\Anaconda3\envs\tensorflow_gpu\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 20, in swig_import_helper return importlib.import_module('_pywrap_tensorflow_internal') File "D:\Programs\Anaconda3\envs\tensorflow_gpu\lib\importlib\__init__.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) ImportError: No module named '_pywrap_tensorflow_internal' Failed to load the native TensorFlow runtime. See https://www.tensorflow.org/install/install_sources#common_installation_problems for some common reasons and solutions. Include the entire stack trace above this error message when asking for help. >>>
OBS STUDIO 编译失败 求解?
![图片说明](https://img-ask.csdn.net/upload/201807/08/1531061918_685111.png)我的环境: WIN7 64位, IDE: VS2015 CMAKE VERSION: cmake-3.12.0-rc2-win64-x64 OBS STUDIO SOURCE_URL: https://github.com/obsproject/obs-studio.git 相关配置: DepsPath:D:\OBS_STUDIO\dependencies2015\win32 QTDIR:D:/Qt/Qt5.8.0/5.8/msvc2015 Libavcoder_DIR: D:/OBS_STUDIO/dependencies2015/win32 **错误提示:** OBS_VERSION: 0.0.1 Found FFmpeg: D:/OBS_STUDIO/dependencies2015/win32/bin/avcodec.lib (found version "57.108.100") found components: avcodec avdevice avutil avformat Scripting: Luajit supported Scripting: Python 3 supported CMake Deprecation Warning at D:/OBS_STUDIO/cmake-3.12.0-rc2-win64-x64/cmake-3.12.0-rc2-win64-x64/share/cmake-3.12/Modules/UseSWIG.cmake:455 (message): SWIG_ADD_MODULE is deprecated. Use SWIG_ADD_LIBRARY instead. Call Stack (most recent call first): deps/obs-scripting/obspython/CMakeLists.txt:33 (SWIG_ADD_MODULE) CMake Deprecation Warning at D:/OBS_STUDIO/cmake-3.12.0-rc2-win64-x64/cmake-3.12.0-rc2-win64-x64/share/cmake-3.12/Modules/UseSWIG.cmake:677 (message): SWIG_LINK_LIBRARIES is deprecated. Use TARGET_LINK_LIBRARIES instead. Call Stack (most recent call first): deps/obs-scripting/obspython/CMakeLists.txt:34 (SWIG_LINK_LIBRARIES) **CMake Error at deps/obs-scripting/obspython/CMakeLists.txt:45 (set_target_properties): set_target_properties Can not find target to add properties to: _obspython Call Stack (most recent call first): deps/obs-scripting/obspython/CMakeLists.txt:76 (install_plugin_bin_swig) ** CMake Deprecation Warning at D:/OBS_STUDIO/cmake-3.12.0-rc2-win64-x64/cmake-3.12.0-rc2-win64-x64/share/cmake-3.12/Modules/UseSWIG.cmake:455 (message): SWIG_ADD_MODULE is deprecated. Use SWIG_ADD_LIBRARY instead. Call Stack (most recent call first): deps/obs-scripting/obslua/CMakeLists.txt:19 (SWIG_ADD_MODULE) CMake Deprecation Warning at D:/OBS_STUDIO/cmake-3.12.0-rc2-win64-x64/cmake-3.12.0-rc2-win64-x64/share/cmake-3.12/Modules/UseSWIG.cmake:677 (message): SWIG_LINK_LIBRARIES is deprecated. Use TARGET_LINK_LIBRARIES instead. Call Stack (most recent call first): deps/obs-scripting/obslua/CMakeLists.txt:20 (SWIG_LINK_LIBRARIES) Jansson >=2.5 not found, building bundled version C compiler: MSVC Found FFmpeg: D:/OBS_STUDIO/dependencies2015/win32/bin/avformat.lib (found version "57.84.100") found components: avformat avutil swscale swresample avcodec Using libavcodec for image loading in libobs Found FFmpeg: D:/OBS_STUDIO/dependencies2015/win32/bin/avcodec.lib (found version "57.108.100") found components: avcodec avutil avformat libdshowcapture submodule not found! Please fetch submodules. win-dshow plugin disabled. Could NOT find LibVLC_INCLUDES (missing: VLC_INCLUDE_DIR) LibVLC includes not found, VLC video plugin disabled enc-amf submodule not found! Please fetch submodules. enc-amf plugin disabled. RSSDK not found, Realsense camera plugin disabled obs-vst submodule not found! Please fetch/update submodules. obs-vst plugin disabled. Libfdk not found - obs-libfdk plugin disabled Found FFmpeg: D:/OBS_STUDIO/dependencies2015/win32/bin/avcodec.lib (found version "57.108.100") found components: avcodec avfilter avdevice avutil swscale avformat swresample Found FFmpeg: D:/OBS_STUDIO/dependencies2015/win32/bin/avcodec.lib (found version "57.108.100") found components: avcodec avutil avformat Configuring incomplete, errors occurred! See also "D:/OBS_STUDIO/ProCmake/buildOBS/CMakeFiles/CMakeOutput.log". See also "D:/OBS_STUDIO/ProCmake/buildOBS/CMakeFiles/CMakeError.log".
swig在aix5.3上面安装失败
ld: 0711-596 SEVERE ERROR: Object CParse/cscanner.o An RLD for section 2 (.data) refers to symbol 1062, but the storage class of the symbol is not C_EXT or C_HIDEXT. ld: 0711-596 SEVERE ERROR: Object CParse/parser.o An RLD for section 2 (.data) refers to symbol 2863, but the storage class of the symbol is not C_EXT or C_HIDEXT. make: 1254-004 The error code from the last command is 12.
SWIG封装C++为python库
我在封装C++的一个类时。生成的库在python中可以正常import 。可是当我C++的类继承其他类在进行封装时,生成的库在python中就没法用了。提示动态库无法初始化。求大神帮助。
Java:带有package的代码如何访问不带package的class?
我有一些C++源代码,通过CMake+SWIG的方式生成了Java代码接口,但是CMake没有相关的命令指定把生成的Java代码放在某个package里。所以生成的代码都如下所示没有package: ``` /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). * Version 4.0.0 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. * ----------------------------------------------------------------------------- */ public class Posit_32_2_t { private transient long swigCPtr; protected transient boolean swigCMemOwn; protected Posit_32_2_t(long cPtr, boolean cMemoryOwn) { swigCMemOwn = cMemoryOwn; swigCPtr = cPtr; } ...... ``` 现在我要在Scala代码里调用这些Java类,可是如果我的Scala声明了package,那么sbt编译的时候就报错说找不到SWIG生成的Java。如果不加package,那么Scala代码又无法区分。这要如何解决?
IContainer container 错误日志怎么看
# http://bugreport.java.com/bugreport/crash.jsp # The crash happened outside the Java Virtual Machine in native code. # See problematic frame for where to report the bug. # --------------- T H R E A D --------------- Current thread (0x000000000021e000): JavaThread "main" [_thread_in_native, id=5608, stack(0x0000000002450000,0x0000000002550000)] siginfo: ExceptionCode=0xc0000005, reading address 0xffffffffffffffff Registers: RAX=0x000000000044df90, RBX=0x0000000059ed85b0, RCX=0x000000000044df90, RDX=0x0000000000000009 RSP=0x000000000254e040, RBP=0x000000000044d6d0, RSI=0x000000000044ef90, RDI=0x0000000000000004 R8 =0x000000006ee77580, R9 =0x000000006ee76490, R10=0x0000000000450d70, R11=0x00000000003d91a0 R12=0x00000000003d99a0, R13=0x0000000000000004, R14=0x0000000000000184, R15=0x000000006fab8f20 RIP=0x000000006ee76520, EFLAGS=0x0000000000010202 Top of Stack: (sp=0x000000000254e040) 0x000000000254e040: 000000006ee76665 000000006ee774c5 0x000000000254e050: 000000006ee77505 000000006ee77545 0x000000000254e060: 000000006ee77585 000000006ee79426 0x000000000254e070: 000000006fa67a80 000000000044df90 0x000000000254e080: 0000000059edaa70 00000000025571e0 0x000000000254e090: 3fe0000000000000 0000000000000000 0x000000000254e0a0: 40c7760000000000 0000000000000000 0x000000000254e0b0: 3fe0000000000000 0000000000000001 0x000000000254e0c0: 0000000059edba70 000000006ea45d24 0x000000000254e0d0: 3f40624dd2f1a9fc 0000000000000000 0x000000000254e0e0: 0000000000000000 0000000000000000 0x000000000254e0f0: 0000000000000000 0000000000000000 0x000000000254e100: 0000000059ee4970 000000006fab7320 0x000000000254e110: 0000000056d27db5 0000000059ed8510 0x000000000254e120: 0000000000000001 000000000044d6d0 0x000000000254e130: 000000000044d750 0000000000000000 Instructions: (pc=0x000000006ee76520) 0x000000006ee76500: c4 e3 5d 0c c0 55 c5 e4 5c c8 c5 e4 58 c0 c5 fc 0x000000006ee76510: 29 01 c5 fc 29 49 20 c3 0f 1f 84 00 00 00 00 00 0x000000006ee76520: c5 fc 28 51 40 c5 fc 28 59 60 c5 ec 5c fb c5 ec 0x000000006ee76530: 58 d3 c5 c4 57 3d 26 41 84 00 c5 ec c6 df be c5 Register to memory mapping: RAX=0x000000000044df90 is an unknown value RBX=0x0000000059ed85b0 is an unknown value RCX=0x000000000044df90 is an unknown value RDX=0x0000000000000009 is an unknown value RSP=0x000000000254e040 is pointing into the stack for thread: 0x000000000021e000 RBP=0x000000000044d6d0 is an unknown value RSI=0x000000000044ef90 is an unknown value RDI=0x0000000000000004 is an unknown value R8 =0x000000006ee77580 is an unknown value R9 =0x000000006ee76490 is an unknown value R10=0x0000000000450d70 is an unknown value R11=0x00000000003d91a0 is an unknown value R12=0x00000000003d99a0 is an unknown value R13=0x0000000000000004 is an unknown value R14=0x0000000000000184 is an unknown value R15=0x000000006fab8f20 is an unknown value Stack: [0x0000000002450000,0x0000000002550000], sp=0x000000000254e040, free space=1016k Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code) C [xuggle7728532234667330671.dll+0x736520] Java frames: (J=compiled Java code, j=interpreted, Vv=VM code) j com.xuggle.xuggler.XugglerJNI.IContainer_open__SWIG_0(JLcom/xuggle/xuggler/IContainer;Ljava/lang/String;IJLcom/xuggle/xuggler/IContainerFormat;)I+0 j com.xuggle.xuggler.IContainer.open(Ljava/lang/String;Lcom/xuggle/xuggler/IContainer$Type;Lcom/xuggle/xuggler/IContainerFormat;)I+15 j vedio.ffmpeg.VedioInfoUtil.getVedioInfo(Ljava/lang/String;)V+10 j test.Test.main([Ljava/lang/String;)V+24 v ~StubRoutines::call_stub
爬虫福利二 之 妹子图网MM批量下载
爬虫福利一:27报网MM批量下载    点击 看了本文,相信大家对爬虫一定会产生强烈的兴趣,激励自己去学习爬虫,在这里提前祝:大家学有所成! 目标网站:妹子图网 环境:Python3.x 相关第三方模块:requests、beautifulsoup4 Re:各位在测试时只需要将代码里的变量 path 指定为你当前系统要保存的路径,使用 python xxx.py 或IDE运行即可。
Java学习的正确打开方式
在博主认为,对于入门级学习java的最佳学习方法莫过于视频+博客+书籍+总结,前三者博主将淋漓尽致地挥毫于这篇博客文章中,至于总结在于个人,实际上越到后面你会发现学习的最好方式就是阅读参考官方文档其次就是国内的书籍,博客次之,这又是一个层次了,这里暂时不提后面再谈。博主将为各位入门java保驾护航,各位只管冲鸭!!!上天是公平的,只要不辜负时间,时间自然不会辜负你。 何谓学习?博主所理解的学习,它
大学四年自学走来,这些私藏的实用工具/学习网站我贡献出来了
大学四年,看课本是不可能一直看课本的了,对于学习,特别是自学,善于搜索网上的一些资源来辅助,还是非常有必要的,下面我就把这几年私藏的各种资源,网站贡献出来给你们。主要有:电子书搜索、实用工具、在线视频学习网站、非视频学习网站、软件下载、面试/求职必备网站。 注意:文中提到的所有资源,文末我都给你整理好了,你们只管拿去,如果觉得不错,转发、分享就是最大的支持了。 一、PDF搜索网站推荐 对于大部
linux系列之常用运维命令整理笔录
本博客记录工作中需要的linux运维命令,大学时候开始接触linux,会一些基本操作,可是都没有整理起来,加上是做开发,不做运维,有些命令忘记了,所以现在整理成博客,当然vi,文件操作等就不介绍了,慢慢积累一些其它拓展的命令,博客不定时更新 顺便拉下票,我在参加csdn博客之星竞选,欢迎投票支持,每个QQ或者微信每天都可以投5票,扫二维码即可,http://m234140.nofollow.ax.
比特币原理详解
一、什么是比特币 比特币是一种电子货币,是一种基于密码学的货币,在2008年11月1日由中本聪发表比特币白皮书,文中提出了一种去中心化的电子记账系统,我们平时的电子现金是银行来记账,因为银行的背后是国家信用。去中心化电子记账系统是参与者共同记账。比特币可以防止主权危机、信用风险。其好处不多做赘述,这一层面介绍的文章很多,本文主要从更深层的技术原理角度进行介绍。 二、问题引入  假设现有4个人
程序员接私活怎样防止做完了不给钱?
首先跟大家说明一点,我们做 IT 类的外包开发,是非标品开发,所以很有可能在开发过程中会有这样那样的需求修改,而这种需求修改很容易造成扯皮,进而影响到费用支付,甚至出现做完了项目收不到钱的情况。 那么,怎么保证自己的薪酬安全呢? 我们在开工前,一定要做好一些证据方面的准备(也就是“讨薪”的理论依据),这其中最重要的就是需求文档和验收标准。一定要让需求方提供这两个文档资料作为开发的基础。之后开发
网页实现一个简单的音乐播放器(大佬别看。(⊙﹏⊙))
今天闲着无事,就想写点东西。然后听了下歌,就打算写个播放器。 于是乎用h5 audio的加上js简单的播放器完工了。 欢迎 改进 留言。 演示地点跳到演示地点 html代码如下`&lt;!DOCTYPE html&gt; &lt;html&gt; &lt;head&gt; &lt;title&gt;music&lt;/title&gt; &lt;meta charset="utf-8"&gt
Python十大装B语法
Python 是一种代表简单思想的语言,其语法相对简单,很容易上手。不过,如果就此小视 Python 语法的精妙和深邃,那就大错特错了。本文精心筛选了最能展现 Python 语法之精妙的十个知识点,并附上详细的实例代码。如能在实战中融会贯通、灵活使用,必将使代码更为精炼、高效,同时也会极大提升代码B格,使之看上去更老练,读起来更优雅。 1. for - else 什么?不是 if 和 else 才
数据库优化 - SQL优化
前面一篇文章从实例的角度进行数据库优化,通过配置一些参数让数据库性能达到最优。但是一些“不好”的SQL也会导致数据库查询变慢,影响业务流程。本文从SQL角度进行数据库优化,提升SQL运行效率。 判断问题SQL 判断SQL是否有问题时可以通过两个表象进行判断: 系统级别表象 CPU消耗严重 IO等待严重 页面响应时间过长
2019年11月中国大陆编程语言排行榜
2019年11月2日,我统计了某招聘网站,获得有效程序员招聘数据9万条。针对招聘信息,提取编程语言关键字,并统计如下: 编程语言比例 rank pl_ percentage 1 java 33.62% 2 c/c++ 16.42% 3 c_sharp 12.82% 4 javascript 12.31% 5 python 7.93% 6 go 7.25% 7
通俗易懂地给女朋友讲:线程池的内部原理
餐厅的约会 餐盘在灯光的照耀下格外晶莹洁白,女朋友拿起红酒杯轻轻地抿了一小口,对我说:“经常听你说线程池,到底线程池到底是个什么原理?”我楞了一下,心里想女朋友今天是怎么了,怎么突然问出这么专业的问题,但做为一个专业人士在女朋友面前也不能露怯啊,想了一下便说:“我先给你讲讲我前同事老王的故事吧!” 大龄程序员老王 老王是一个已经北漂十多年的程序员,岁数大了,加班加不动了,升迁也无望,于是拿着手里
经典算法(5)杨辉三角
写在前面: 我是 扬帆向海,这个昵称来源于我的名字以及女朋友的名字。我热爱技术、热爱开源、热爱编程。技术是开源的、知识是共享的。 这博客是对自己学习的一点点总结及记录,如果您对 Java、算法 感兴趣,可以关注我的动态,我们一起学习。 用知识改变命运,让我们的家人过上更好的生活。 目录一、杨辉三角的介绍二、杨辉三角的算法思想三、代码实现1.第一种写法2.第二种写法 一、杨辉三角的介绍 百度
腾讯算法面试题:64匹马8个跑道需要多少轮才能选出最快的四匹?
昨天,有网友私信我,说去阿里面试,彻底的被打击到了。问了为什么网上大量使用ThreadLocal的源码都会加上private static?他被难住了,因为他从来都没有考虑过这个问题。无独有偶,今天笔者又发现有网友吐槽了一道腾讯的面试题,我们一起来看看。 腾讯算法面试题:64匹马8个跑道需要多少轮才能选出最快的四匹? 在互联网职场论坛,一名程序员发帖求助到。二面腾讯,其中一个算法题:64匹
面试官:你连RESTful都不知道我怎么敢要你?
面试官:了解RESTful吗? 我:听说过。 面试官:那什么是RESTful? 我:就是用起来很规范,挺好的 面试官:是RESTful挺好的,还是自我感觉挺好的 我:都挺好的。 面试官:… 把门关上。 我:… 要干嘛?先关上再说。 面试官:我说出去把门关上。 我:what ?,夺门而去 文章目录01 前言02 RESTful的来源03 RESTful6大原则1. C-S架构2. 无状态3.统一的接
JDK12 Collectors.teeing 你真的需要了解一下
前言在 Java 12 里面有个非常好用但在官方 JEP 没有公布的功能,因为它只是 Collector 中的一个小改动,它的作用是 merge 两个 collector 的结果,这句话
为啥国人偏爱Mybatis,而老外喜欢Hibernate/JPA呢?
关于SQL和ORM的争论,永远都不会终止,我也一直在思考这个问题。昨天又跟群里的小伙伴进行了一番讨论,感触还是有一些,于是就有了今天这篇文。 声明:本文不会下关于Mybatis和JPA两个持久层框架哪个更好这样的结论。只是摆事实,讲道理,所以,请各位看官勿喷。 一、事件起因 关于Mybatis和JPA孰优孰劣的问题,争论已经很多年了。一直也没有结论,毕竟每个人的喜好和习惯是大不相同的。我也看
SQL-小白最佳入门sql查询一
一 说明 如果是初学者,建议去网上寻找安装Mysql的文章安装,以及使用navicat连接数据库,以后的示例基本是使用mysql数据库管理系统; 二 准备前提 需要建立一张学生表,列分别是id,名称,年龄,学生信息;本示例中文章篇幅原因SQL注释略; 建表语句: CREATE TABLE `student` ( `id` int(11) NOT NULL AUTO_INCREMENT, `
项目中的if else太多了,该怎么重构?
介绍 最近跟着公司的大佬开发了一款IM系统,类似QQ和微信哈,就是聊天软件。我们有一部分业务逻辑是这样的 if (msgType = "文本") { // dosomething } else if(msgType = "图片") { // doshomething } else if(msgType = "视频") { // doshomething } else { // dosho
【图解经典算法题】如何用一行代码解决约瑟夫环问题
约瑟夫环问题算是很经典的题了,估计大家都听说过,然后我就在一次笔试中遇到了,下面我就用 3 种方法来详细讲解一下这道题,最后一种方法学了之后保证让你可以让你装逼。 问题描述:编号为 1-N 的 N 个士兵围坐在一起形成一个圆圈,从编号为 1 的士兵开始依次报数(1,2,3…这样依次报),数到 m 的 士兵会被杀死出列,之后的士兵再从 1 开始报数。直到最后剩下一士兵,求这个士兵的编号。 1、方
致 Python 初学者
文章目录1. 前言2. 明确学习目标,不急于求成,不好高骛远3. 在开始学习 Python 之前,你需要做一些准备2.1 Python 的各种发行版2.2 安装 Python2.3 选择一款趁手的开发工具3. 习惯使用IDLE,这是学习python最好的方式4. 严格遵从编码规范5. 代码的运行、调试5. 模块管理5.1 同时安装了py2/py35.2 使用Anaconda,或者通过IDE来安装模
“狗屁不通文章生成器”登顶GitHub热榜,分分钟写出万字形式主义大作
一、垃圾文字生成器介绍 最近在浏览GitHub的时候,发现了这样一个骨骼清奇的雷人项目,而且热度还特别高。 项目中文名:狗屁不通文章生成器 项目英文名:BullshitGenerator 根据作者的介绍,他是偶尔需要一些中文文字用于GUI开发时测试文本渲染,因此开发了这个废话生成器。但由于生成的废话实在是太过富于哲理,所以最近已经被小伙伴们给玩坏了。 他的文风可能是这样的: 你发现,
程序员:我终于知道post和get的区别
IT界知名的程序员曾说:对于那些月薪三万以下,自称IT工程师的码农们,其实我们从来没有把他们归为我们IT工程师的队伍。他们虽然总是以IT工程师自居,但只是他们一厢情愿罢了。 此话一出,不知激起了多少(码农)程序员的愤怒,却又无可奈何,于是码农问程序员。 码农:你知道get和post请求到底有什么区别? 程序员:你看这篇就知道了。 码农:你月薪三万了? 程序员:嗯。 码农:你是怎么做到的? 程序员:
GitHub标星近1万:只需5秒音源,这个网络就能实时“克隆”你的声音
作者 | Google团队译者 | 凯隐编辑 | Jane出品 | AI科技大本营(ID:rgznai100)本文中,Google 团队提出了一种文本语音合成(text to speech)神经系统,能通过少量样本学习到多个不同说话者(speaker)的语音特征,并合成他们的讲话音频。此外,对于训练时网络没有接触过的说话者,也能在不重新训练的情况下,仅通过未知说话者数秒的音频来合成其讲话音频,即网
《程序人生》系列-这个程序员只用了20行代码就拿了冠军
你知道的越多,你不知道的越多 点赞再看,养成习惯GitHub上已经开源https://github.com/JavaFamily,有一线大厂面试点脑图,欢迎Star和完善 前言 这一期不算《吊打面试官》系列的,所有没前言我直接开始。 絮叨 本来应该是没有这期的,看过我上期的小伙伴应该是知道的嘛,双十一比较忙嘛,要值班又要去帮忙拍摄年会的视频素材,还得搞个程序员一天的Vlog,还要写BU
加快推动区块链技术和产业创新发展,2019可信区块链峰会在京召开
      11月8日,由中国信息通信研究院、中国通信标准化协会、中国互联网协会、可信区块链推进计划联合主办,科技行者协办的2019可信区块链峰会将在北京悠唐皇冠假日酒店开幕。   区块链技术被认为是继蒸汽机、电力、互联网之后,下一代颠覆性的核心技术。如果说蒸汽机释放了人类的生产力,电力解决了人类基本的生活需求,互联网彻底改变了信息传递的方式,区块链作为构造信任的技术有重要的价值。   1
程序员把地府后台管理系统做出来了,还有3.0版本!12月7号最新消息:已在开发中有github地址
第一幕:缘起 听说阎王爷要做个生死簿后台管理系统,我们派去了一个程序员…… 996程序员做的梦: 第一场:团队招募 为了应对地府管理危机,阎王打算找“人”开发一套地府后台管理系统,于是就在地府总经办群中发了项目需求。 话说还是中国电信的信号好,地府都是满格,哈哈!!! 经常会有外行朋友问:看某网站做的不错,功能也简单,你帮忙做一下? 而这次,面对这样的需求,这个程序员
网易云6亿用户音乐推荐算法
网易云音乐是音乐爱好者的集聚地,云音乐推荐系统致力于通过 AI 算法的落地,实现用户千人千面的个性化推荐,为用户带来不一样的听歌体验。 本次分享重点介绍 AI 算法在音乐推荐中的应用实践,以及在算法落地过程中遇到的挑战和解决方案。 将从如下两个部分展开: AI 算法在音乐推荐中的应用 音乐场景下的 AI 思考 从 2013 年 4 月正式上线至今,网易云音乐平台持续提供着:乐屏社区、UGC
【技巧总结】位运算装逼指南
位算法的效率有多快我就不说,不信你可以去用 10 亿个数据模拟一下,今天给大家讲一讲位运算的一些经典例子。不过,最重要的不是看懂了这些例子就好,而是要在以后多去运用位运算这些技巧,当然,采用位运算,也是可以装逼的,不信,你往下看。我会从最简单的讲起,一道比一道难度递增,不过居然是讲技巧,那么也不会太难,相信你分分钟看懂。 判断奇偶数 判断一个数是基于还是偶数,相信很多人都做过,一般的做法的代码如下
【管理系统课程设计】美少女手把手教你后台管理
【后台管理系统】URL设计与建模分析+项目源码+运行界面 栏目管理、文章列表、用户管理、角色管理、权限管理模块(文章最后附有源码) 一、这是一个什么系统? 1.1 学习后台管理系统的原因 随着时代的变迁,现如今各大云服务平台横空出世,市面上有许多如学生信息系统、图书阅读系统、停车场管理系统等的管理系统,而本人家里就有人在用烟草销售系统,直接在网上完成挑选、购买与提交收货点,方便又快捷。 试想,
4G EPS 第四代移动通信系统
目录 文章目录目录4G EPSEPS 的架构EPS 的参考模型E-UTRANUEeNodeBEPCMME(移动性控制处理单元)S-GW(E-RAB 无线访问承载接入点)P-GW(PDN 接入点)HSS(用户认证中心)PCRF(计费规则与策略)SPR(用户档案)OCS(在线计费)OFCS(离线计费)接口类型Uu 接口(空中接口,UE 和 AN 之间)S1 接口(AN 和 CN 之间)S1-U 接口和
相关热词 c# 图片上传 c# gdi 占用内存 c#中遍历字典 c#控制台模拟dos c# 斜率 最小二乘法 c#进程延迟 c# mysql完整项目 c# grid 总行数 c# web浏览器插件 c# xml 生成xsd
立即提问