我一直在我的Mac上开发一个应用程序,现在我正在尝试 在Windows框上设置开发环境。应用程序文件位于 所以我开始使用virtualenv,它安装得很好:
<extracted virtualenv-1.10.1.tar.gz>
cd virtualenv-1.10.1
C:\Python27\python.exe setup.py install
我导航到我的应用程序开发文件夹并运行develop命令:
(env) C:\Users\eclaird\work\MyApplication>python setup.py develop
这似乎运行得很好,安装了依赖项,所有这些:
running develop
running egg_info
writing requirements to MyApplication.egg-info\requires.txt
writing MyApplication.egg-info\PKG-INFO
writing top-level names to MyApplication.egg-info\top_level.txt
writing dependency_links to MyApplication.egg-info\dependency_links.txt
reading manifest file 'MyApplication.egg-info\SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: no files found matching 'rpm\*.json'
warning: no previously-included files matching 'dev_*' found under directory 'MyApplication'
writing manifest file 'MyApplication.egg-info\SOURCES.txt'
running build_ext
Creating c:\users\eclaird\work\env\lib\site-packages\MyApplication.egg-link (link to .)
Adding MyApplication 1.2.30 to easy-install.pth file
Installing MyApplication-do-stuff.py script to C:\Users\eclaird\work\env\Scripts
Installed c:\users\eclaird\work\MyApplication
Processing dependencies for MyApplication==1.2.30
[... snip ...]
Finished processing dependencies for MyApplication==1.2.30
但我在尝试运行应用程序脚本时遇到以下错误:
(env) C:\Users\eclaird\work\MyApplication>MyApplication-do-stuff.py -c dev-config.json
Traceback (most recent call last):
File "C:\Users\eclaird\work\env\Scripts\MyApplication-do-stuff.py", line 4, in <module>
from pkg_resources import require; require('MyApplication==1.2.30')
File "build\bdist.win-amd64\egg\pkg_resources.py", line 2793, in <module>
File "build\bdist.win-amd64\egg\pkg_resources.py", line 673, in require
File "build\bdist.win-amd64\egg\pkg_resources.py", line 576, in resolve
pkg_resources.DistributionNotFound: MyApplication==1.2.30
同样的步骤在我的Mac上也很有效。有什么问题吗?你知道吗
我忘了shebang在Windows上什么都不做,所以运行
MyApplication-do-stuff.py
脚本实际上是由系统范围的Python安装来处理的。当然,这意味着您无法从虚拟环境中获得任何包,而且我的问题中存在一个模糊的错误。像这样运行脚本似乎是可行的:相关问题 更多 >
编程相关推荐