python 3.5 import theano ::hypot error

# win10 , mingw(nuwen,g++ 6.3), python 3.5 ,

描述:

import theano 时生成动态的 mod.cpp ,然后编译库的时候报 ::hypot 未定义

原因:

hypot 在"C:\Program Files\Python35\include\pyconfig.h"被重定义了

pyconfig.h

-------------------------------------------

#define hypot _hypot

-------------------------------------------

解决思路:

在import theano 调用 g++ 编译mod.cpp的时候添加编译参数  -D_hypot=hypot

实现:

有多种方法可行,例如给 theano 添加配置文件等。

一种实际操作方法:

搜索 theano 文件夹下面含有编译参数字符串的文件,然后在某个编译参数后面加上 -D_hypot=hypot

例如:

cc.py      "C:\Program Files\Python35\Lib\site-packages\theano\gof\cc.py"

-------------------------------------------

def compile_args(self):

...

"-Wno-write-strings",  # generated by our code generator...
"-D_hypot=hypot",
]

-------------------------------------------

cmodule.py   "C:\Program Files\Python35\Lib\site-packages\theano\gof\cmodule.py"

-------------------------------------------

def get_gcc_shared_library_arg():

...

return ‘-shared -D_hypot=hypot‘

-------------------------------------------

时间: 2024-07-28 14:55:21

python 3.5 import theano ::hypot error的相关文章

Command "python setup.py egg_info" failed with error code 1一种问题的解决方法

问题描述:无论是你在pycharm中直接使用import and install命令,还是pip的时候出现了Command "python setup.py egg_info" failed with error code 1这样的问题描述,需要考虑可能pip的这个源里面没有对应的python3.5的模块 解决方法:通常可以直接google "XXX for python3.5",或者在github中找到对应的python3.5的项目,将对应的.py文件添加到pyt

安装TA-Lib时报错:ubuntu****, Command "/usr/bin/python -u -c "import setuptools, tokenize;__file__='

使用pip install TA-Lib 时报错: ERROR: Complete output from command /usr/bin/python3 -u -c 'import setuptools, tokenize;__file__='"'"'/tmp/pip-install-afeznd8w/TA-Lib/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open

Python中的import和from import

一.Python路径介绍 在python用import或者from...import来导入相应的模块. 模块其实就是一些函数和类的集合文件,它能实现一些相应的功能,当我们需要使用这些功能的时候,直接把相应的模块导入到我们的程序中,我们就可以使用了. 这类似于C语言中的include头文件,Python中我们用import导入我们需要的模块. 二.搜索路径 Python会在以下路径中搜索它想要寻找的模块: 1. 程序所在的文件夹 2. 标准库的安装路径 3. 操作系统环境变量PYTHONPATH所

python之禅 --- import this

>>> import thisThe Zen of Python, by Tim Peters Beautiful is better than ugly.Explicit is better than implicit.Simple is better than complex.Complex is better than complicated.Flat is better than nested.Sparse is better than dense.Readability cou

python中的import,reload,以及__import__

import作用:导入/引入一个python标准模块,其中包括.py文件.带有__init__.py文件的目录.e.g: [python] view plaincopy import module_name[,module1,...] from module import *|child[,child1,...] 说明:多次重复使用import语句时,不会重新加载被指定的模块,只是把对该模块的内存地址给引用到本地变量环境.测试: [python] view plaincopy a.py #!/u

解决安装ipython时Command "python setup.py egg_info" failed with error code 1 in /tmp

最近使用ubuntu16.04 server版安装ipython的时候一直在报错: IPython 6.0+ does not support Python 2.6, 2.7, 3.0, 3.1, or 3.2.      When using Python 2.7, please install IPython 5.x LTS Long Term Support version. python2.7 ipython Command "python setup.py egg_info"

python中的import

python中的import操作有点类似于C语言中的#include,但又有很大的不同.在c语言中,#include是编译前将另一个文件包含进当前文件中.在python中导入并非只把一个文件文本插入另一个文件而已. 导入其实是运行时的运算,程序第一次导入时会执行三个步骤. 1 找到模块文件 2 在需要时编译成位码 3执行模块的代码来创建其所定义的对象 这三个步骤只有在模块第一次被导入的时候才会执行,之后导入相同模块的时候会跳过这三个步骤,而只提取内存中所加载的模块对象. python会把载入的模

解决Command "python setup.py egg_info" failed with error code 1坎坷路

机器:os x 本地想跑一下一个开源django博客应用,下了源码到里头pip install -r requirements.txt 结果屡次出错,Command "python setup.py egg_info" failed with error code 1 试了多次一直于最后一行这个错误. 我开始以为权限问题,setuptools问题 后来有转机了,我把 requirements.txt里头一个个安装,最后原是psycopg2这个安装有问题 pip我错怪你了,不过把官方源换

python scrapy cannot import name xmlrpc_client的解决方案,解决办法

安装scrapy的时候遇到如下错误的解决办法: "python scrapy cannot import name xmlrpc_client" 先执行 sudo pip uninstall six 再执行 sudo easy_install six 验证是否解决: scrapy