vn.py量化社区
By Traders, For Traders.
Member
avatar
加入于:
帖子: 21
声望: 1

topdo@virtual-machine:~/vnpy-2.0.4/examples/vn_trader$ python run.py
Traceback (most recent call last):
File "run.py", line 8, in <module>
from vnpy.gateway.futu import FutuGateway
File "/usr/local/lib/python3.6/dist-packages/vnpy/gateway/futu/init.py", line 1, in <module>
from .futu_gateway import FutuGateway
File "/usr/local/lib/python3.6/dist-packages/vnpy/gateway/futu/futu_gateway.py", line 11, in <module>
from futu import (
File "/usr/local/lib/python3.6/dist-packages/futu/init.py", line 22, in <module>
from futu.quote.open_quote_context import OpenQuoteContext
File "/usr/local/lib/python3.6/dist-packages/futu/quote/open_quote_context.py", line 11, in <module>
from futu.common.open_context_base import OpenContextBase, ContextStatus
File "/usr/local/lib/python3.6/dist-packages/futu/common/open_context_base.py", line 11, in <module>
from futu.common.utils import
File "/usr/local/lib/python3.6/dist-packages/futu/common/utils.py", line 8, in <module>
from futu.common.conn_mng import

File "/usr/local/lib/python3.6/dist-packages/futu/common/conn_mng.py", line 5, in <module>
from futu.common.constant import *
File "/usr/local/lib/python3.6/dist-packages/futu/common/constant.py", line 140, in <module>
from futu.common.pb import Trd_Common_pb2
File "/usr/local/lib/python3.6/dist-packages/futu/common/pb/Trd_Common_pb2.py", line 17, in <module>
import Common_pb2 as Commonpb2
File "/usr/local/lib/python3.6/dist-packages/futu/common/pb/Common_pb2.py", line 182, in <module>
options=None, file=DESCRIPTOR),
TypeError:
new__() got an unexpected keyword argument 'file'

Administrator
avatar
加入于:
帖子: 4033
声望: 222

这是富途证券FutuGateway接口加载错误,最简单的处理就是注释掉不用,如果确定需要用请联系下富途那边了

Member
avatar
加入于:
帖子: 21
声望: 1

用Python的交易员 wrote:

这是富途证券FutuGateway接口加载错误,最简单的处理就是注释掉不用,如果确定需要用请联系下富途那边了
谢谢。
重新安装了Anaconda3以后,再装了一遍,上面的问题不出现了。但是在安装过程中出现了下面的一些错误

Collecting psycopg2 (from -r requirements.txt (line 9))
Downloading https://pypi.tuna.tsinghua.edu.cn/packages/5c/1c/6997288da181277a0c29bc39a5f9143ff20b8c99f2a7d059cfb55163e165/psycopg2-2.8.3.tar.gz (377kB)
|████████████████████████████████| 378kB 5.6MB/s
ERROR: Complete output from command python setup.py egg_info:
ERROR: running egg_info
creating pip-egg-info/psycopg2.egg-info
writing pip-egg-info/psycopg2.egg-info/PKG-INFO
writing dependency_links to pip-egg-info/psycopg2.egg-info/dependency_links.txt
writing top-level names to pip-egg-info/psycopg2.egg-info/top_level.txt
writing manifest file 'pip-egg-info/psycopg2.egg-info/SOURCES.txt'

Error: pg_config executable not found.

pg_config is required to build psycopg2 from source.  Please add the directory
containing pg_config to the $PATH or specify the full executable path with the
option:

    python setup.py build_ext --pg-config /path/to/pg_config build ...

or with the pg_config option in 'setup.cfg'.

If you prefer to avoid building psycopg2 from source, please install the PyPI
'psycopg2-binary' package instead.

For further information please check the 'doc/src/install.rst' file (also at
<http://initd.org/psycopg/docs/install.html>).

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

ERROR: Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-install-84i2hsws/psycopg2/
Generating locales (this might take a while)...

安装结束后在/examples/vn_trader/下运行python run.py时,居然第一句就没通过,如下

Installing collected packages: vnpy
Found existing installation: vnpy 2.0.4
Uninstalling vnpy-2.0.4:
Successfully uninstalled vnpy-2.0.4
Successfully installed vnpy-2.0.4
(base) topdo@virtual-machine:~/vnpy-2.0.4$ cd examples/vn_trader
(base) topdo@virtual-machine:~/vnpy-2.0.4/examples/vn_trader$ python run.py
Traceback (most recent call last):
File "run.py", line 1, in <module>
from vnpy.event import EventEngine
ModuleNotFoundError: No module named 'vnpy'

Administrator
avatar
加入于:
帖子: 4033
声望: 222

vnpy安装失败了,是用install.sh在安装?

Member
avatar
加入于:
帖子: 21
声望: 1

用Python的交易员 wrote:

vnpy安装失败了,是用install.sh在安装?
是啊,sudo bash install.sh

Member
avatar
加入于:
帖子: 21
声望: 1

钱程 wrote:

用Python的交易员 wrote:

vnpy安装失败了,是用install.sh在安装?
是啊,sudo bash install.sh

错误在哪里,怎么搞

Member
avatar
加入于:
帖子: 21
声望: 1

钱程 wrote:

钱程 wrote:

用Python的交易员 wrote:

vnpy安装失败了,是用install.sh在安装?
是啊,sudo bash install.sh

错误在哪里,怎么搞
中间有一段是psycopg2未能正确安装,重新安装后,解决了

Member
avatar
加入于:
帖子: 21
声望: 1

Traceback (most recent call last):
File "run.py", line 1, in <module>
from vnpy.event import EventEngine
ModuleNotFoundError: No module named 'vnpy'
这是找不到vnpy模块啊?

Administrator
avatar
加入于:
帖子: 198
声望: 35

试一下手动粘贴vnpy。
在Anaconda3中找到运行vnpy目录,例如我的是C:\ProgramData\Anaconda3\Lib\site-packages\vnpy-1.9.2-py3.7.egg,然后下载master或者dev分支,解压后把里面的vnpy文件直接粘贴(替换)到运行目录里。

或者彻底删除Anaconda/删除其余python环境,按照vnstudio2.0.4

© 2015-2019 上海韦纳软件科技有限公司
备案服务号:沪ICP备18006526号-3